I'm trying to set the text in an NSTextField, but the -setStringValue:
and -setTitleWithMnemonic:
methods are not working. Any ideas?
相关问题
- Xcode debugger displays incorrect values for varia
- Is there a way to report errors in Apple documenta
- Advice for supporting both Mac and Windows Desktop
- Avoid cmake to add the flags -search_paths_first a
- NSOutlineView drag line stuck + blue border
相关文章
- 现在使用swift开发ios应用好还是swift?
- Visual Studio Code, MAC OS X, OmniSharp server is
- xcode 4 garbage collection removed?
- IntelliJ IDEA can't open projects or add SDK o
- Automator: How do I use the Choose from List actio
- ImportError: No module named twisted.persisted.sty
- How can I vertically align my status bar item text
- Converting (u)int64_t to NSNumbers
setStringValue:
is the way to do it. You should make sure your outlet is being set properly. (In the debugger, make sure your textfield variable is not null.)Just
myLabel.stringValue = "MY TEXT"
works here, using Swift and Xcode 6.just do this
Swift 4
Note: Fetching value from self.yourTextField.stringValue at that will get warning message i.e. To avoid this kind of warning you can use like this (suggested way)
OR also refer to this.
ObjectiveC:
original code I use in my code to display application version is:
Just do something like this: