1

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?

2 Answers2

1

The -stringValue method can be used.

NSTextField *myTextField = [[NSTextField alloc] initWithFrame:...];
NSString    *text        = [myTextField stringValue];
NSLog(@"%@", text);

enter image description here

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