Get value from NSTextField
Swift 3.x Version:
myField.stringValue
[myField stringValue]
NSTextField
inherits from NSControl
, and NSControl
defines the stringValue
/setStringvalue:
methods.
For an NSString
you would use:
NSString *myString = [theTextField stringValue];
For an int
you would use:
int myInt = [theTextField intValue];
There are many other methods for getting the value from a control. Have a look at the NSControl
reference for more info, under the "Getting and Setting the Control’s Value" section.
Here's a list:
doubleValue
floatValue
intValue
integerValue
objectValue
stringValue
attributedStringValue