cocoa help

jamesrichie54

Registered
hello my name is james and im just starting out as a programmer and so far i ve programed two apps thi being my second and ive encountered a problem

#import "AppController.h"

@implementation AppController
- (IBAction)add3:(id)sender {
[textBox1 setIntValue:[textBox1 intValue] + 3];
}

- (IBAction)subtract3:(id)sender {
[textBox1 setIntValue:[textBox1 intValue] - 3];
}
@end
it says theres a syntax error after { but i see no problem
could you guys help me out thanks
 
There are two "{" characters. Which one triggers the syntax error? Can you post the contents of your header file too?
 
it says theres two syntax error and im still so new to obective-c and programming in general i have to ask what is a header file? is it the .m file?
 
That could be why you're having problems ;)

The code that you've posted should go into the .m file. Headers contain interface code while .m files contain the implementation details.

Looking at your code, I'm guessing that your header file should contain something like the following

Code:
@interface AppController : NSObject {
  IBOutlet id textBox1;
}
- (IBAction)add3:(id)sender;
- (IBAction)subtract3:(id)sender;
@end
 
Back
Top