|
#1
| |||
| |||
| cocoa help 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 |
|
#2
| ||||
| ||||
| There are two "{" characters. Which one triggers the syntax error? Can you post the contents of your header file too? |
|
#3
| |||
| |||
| 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? |
|
#4
| ||||
| ||||
| The header is the .h file. |
|
#5
| |||
| |||
| whats posted above is the header file then |
|
#6
| ||||
| ||||
| 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 |
![]() |
| Thread Tools | |
|
|