i am following along(mostly, im playing around with different functionality) with sams teach yourself cocoa touch programming and im building a calculator but when i try to initialize an object of the calculatormodel class i get this error: " error: initializer element is not constant". can anyone explain this or give me a solution? thanks so much
#import "CalculatorController.h"
#import "CalculatorModel.h";
@implementation CalculatorController
CalculatorModel *calc = [[CalculatorModel alloc] init]; //error is here
-(void) pressButton:(UIButton*) sender;{
if ([[(UIButton *)sender currentTitle] isEqualToString:@"0"]){
[calc setValue:0];
NSLog(@"Value: %i\n", calc.value);
}
else if ([[(UIButton *)sender currentTitle] isEqualToString:@"1"]){
[calc setValue:1];
NSLog(@"Value: %i\n", calc.value);
}
}
- (id) init {
fprintf(stderr, "CalculatorController created");
return [super init];
}
@end