访问 NSTextField 的文本变量?

Access text variable of NSTextField?

我想访问 NSTextField 的文本变量?

我试过了。但它不起作用。

name = textfield.text

错误:"Value of type 'NSTextField' has no member 'text'"

您是否将它与 iOS 上的 UITextField 混淆了? Mac OS X 上对应的 属性 是 stringValue

name = textfield.stringValue