I am a programming noob, so please excuse my lack of experience. Hillegasse's challenge was to create an application that will count the amount of characters in a text field. But mine crashes- I can't really understand what's on the debugger (it just says that GNU has no warranty so here is my code (garbage collection is on)
AppController.h
AppContoller.m
Attatched is the interface- or at least how I created it in Interface builder. I control dragged from the button to the AppController object, and then command-clicking the AppController objects, I connected it to the two textfields.
Thank you so much for your help.
AppController.h
Code:
#import <Cocoa/Cocoa.h>
@interface AppController : NSObject
{
IBOutlet NSTextField *input;
IBOutlet NSTextField *output;
}
-(IBAction)countIt:(id) sender;
@end
AppContoller.m
Code:
#import "AppController.h"
@implementation AppController
-(IBAction)countIt:(id)sender
{
NSString *string1 = [input stringValue];
NSString *string2 = [string1 length];
[output setStringValue:(@"%@", string2)];
}
@end
Thank you so much for your help.