Retrieving Data from NSTextField in Cocoa Mac

By | March 19, 2011


If you want to retrieve the data a user typed in on a Cocoa Mac application, follow the following steps.
1. You first need to declare a NSTextField variable in .h file

@interface SampleAppDelegate : NSObject {
NSTextField *myText;
@property (retain) IBOutlet NSTextField *myText;

2. Then you need to synthesize it for properties in .m file

@synthesize myText;

3. Connect myText with the interface
4. For getting data from this ‘myText’ use the following code


Leave a Reply

Your email address will not be published. Required fields are marked *