[英]Trouble with NSTextField in Swift using xcode 6.1 (OSX)
我启动了Swift,但没有启动ObjectiveC。有人可以教我如何在OSX下使用xcode 6.1在Swift中获取和设置NSTextField
吗?
You get and set the value of an NSTextField
with the stringValue
property. 您可以使用
stringValue
属性获取并设置NSTextField
的值。 For instance, if you have this @IBOutlet
in your app: 例如,如果您的应用程序中有此
@IBOutlet
:
@IBOutlet weak var textfield: NSTextField!
getting the value: 获得价值:
println("textfield is \(textfield.stringValue)")
setting the value: 设置值:
textfield.stringValue = "this is my string"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.