I'm trying to make a simple Cocoa application using the newest version of XCode. In interface builder I added NSTextField and NSButton. When I press the button, I want it to clear whatever is in the text field.
I made a new class called AppController.h. This is the contents:
#import <Foundation/Foundation.h>
@interface AppController : NSObject {
IBOutlet id textView;
}
- (IBAction) clearText: sender;
@end
AppController.m looks like this:
#import "AppController.h"
@implementation AppController
- (IBAction) clearText: sender
{
[textView setString: @" "];
}
@end
I connected the button to clearText and the textbox to textView.
The program compiles and runs. But when I press the button, nothing happens. Why is that?