tags:

views:

1079

answers:

2

I'm a beginner,thank u very much.

+3  A: 

[myField stringValue]

NSTextField inherits NSControl, and NSControl defines the stringValue/setStringvalue methods.

NilObject
thank u very much:)
anakin
+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
thank u very much:)
anakin