I'm a beginner,thank u very much.
+3
A:
[myField stringValue]
NSTextField inherits NSControl, and NSControl defines the stringValue/setStringvalue methods.
NilObject
2009-06-12 05:45:52
thank u very much:)
anakin
2009-06-12 06:06:47
+5
A:
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 http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSControl_Class/Reference/Reference.html#//apple_ref/occ/cl/NSControl for more info, under the "Setting the Control’s Value" section.
Here's a list:
doubleValue
floatValue
intValue
integerValue
objectValue
stringValue
attributedStringValue
toholio
2009-06-12 05:55:43