I'm new to OS X development in Xcode and was wondering how to get the text from a text field and NSLog it, I would also like to pass it to a string. Any help?
Asked
Active
Viewed 3,524 times
2 Answers
1
The -stringValue method can be used.
NSTextField *myTextField = [[NSTextField alloc] initWithFrame:...];
NSString *text = [myTextField stringValue];
NSLog(@"%@", text);

Do not be fooled by those who say that text is a property of NSTextField.
Brian Tracy
- 6,801
- 2
- 33
- 48
-1
Before asking questions like this, please read up on the documentation here:NSTextView. Also please take a look at all of Apple's documentation here:Apple Documentation
Milo
- 5,041
- 7
- 33
- 59