3 class HelpPopoverViewController: NSViewController {
5 var labelString: String = "Captura"
6 let textField = NSTextField()
8 override func loadView() {
10 self.view.frame = NSRect(x: 0, y: 0, width: 250, height: 40)
12 textField.stringValue = labelString
13 textField.font = NSFont(name: "Hiragino Mincho ProN", size: 12)
14 textField.isEditable = false
15 textField.isBezeled = false
16 textField.isSelectable = false
17 textField.backgroundColor = NSColor.clear
20 let x = (view.frame.width - textField.frame.width) / 2
21 let y = (view.frame.height - textField.frame.height) / 2
22 textField.frame.origin = NSPoint(x: x, y: y)
24 self.view.addSubview(textField)
27 func updateLabel(_ newLabel: String) {
28 labelString = newLabel
29 textField.stringValue = labelString
32 let x = (view.frame.width - textField.frame.width) / 2
33 let y = (view.frame.height - textField.frame.height) / 2
34 textField.frame.origin = NSPoint(x: x, y: y)