I need help porting my Mac OS X app into an Iphone app! Here is my app controller.h
and here is my appcontroller.m
What needs to change?
Code:
@interface DoorController : NSObject {
int level;
int highScore;
int wrongCount;
IBOutlet NSTextField *levelLabel;
IBOutlet NSTextField *scoreLabel;
IBOutlet NSTextField *successLabel;
IBOutlet NSTextField *wrong;
}
- (IBAction)resetDoor:(id)sender;
- (IBAction)clickDoor:(id)sender;
- (void)setLevel:(int)newLevel withMessage:(NSString *)message;
@end
and here is my appcontroller.m
Code:
@implementation DoorController
- (void)awakeFromNib {
srandom(time(NULL));
[self setLevel:1 withMessage:nil];
}
- (IBAction)clickDoor:(id)sender {
int correctDoor = random() % 3 + 1;
(correctDoor == [sender tag])
[self setLevel]:level + 1 withMessage:[NSString stringWithFormat:@"You passed! Welcome to level %i!", level + 1]];
else {
[self setLevel:1 withMessage:[NSString stringWithFormat:@"Sorry, you failed! The correct door was door #%i!", correctDoor]];
wrongCount++;
[wrong setStringValue:[NSString stringWithFormat:@"In this session you have gotten %d wrong", wrongCount]];
}
- (void)setLevel:(int)newLevel withMessage:(NSString *)message {
level = newLevel;
[levelLabel setStringValue:[NSString stringWithFormat:@"Level %i", level]];
if (message)
[successLabel setStringValue:message];
if (level > highScore) {
highScore = level;
[scoreLabel setStringValue:[NSString stringWithFormat:@"High Score: %i", highScore]];
}
}
@end
What needs to change?