我似乎无法更改我正在尝试制作的Mac应用程序中的文本标签。我正在使用swift。下面是我使用的代码:
@IBOutlet var sumlab: NSTextField!
sumlab.text = "\(result.sum)" // result.sum is the result of a function I made
// I also tried this:
sumlab.text("\(result.sum)")
// and this:
sumlab.insertText("\(result.sum)")
所有这些似乎都不起作用,这是我完成我的程序需要解决的唯一问题。另外,当我编写sumlab.text时,它显示NSTextField没有名为text的成员
发布于 2014-10-24 05:29:35
NSTextField不同于UITextField。它没有text
属性。但是,它继承自具有stringValue属性的NSControl。
sumlab.stringValue = "\(result.sum)"
https://stackoverflow.com/questions/26536572
复制相似问题