So, I follow this Xcode tutorial: Iphone and Ipad Game Development for Dummies. This is a good book, but there are some flaws here and there. Most of the time I can find a way to overcome these shortcomings, but now I stumbled on the fact that I canโt fix it. Even their website or contacts do not know the answer.
I'm trying to make a game with cars and stuff. But the problem is the main menu. I already made buttons with custom button mode. And used IbActions to make them work (in fact, the โNew Gameโ is the only button that now works because its function is already written). But now I have to do IBOutlets to give them an animation. The book told me to use QuartzCore.framework. Now the problem is that when I try to build it, I get this error: the declaration of the newGameButton property was not found in the interface.
This is my script.
Header file:
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@interface MainMenuViewController : UIViewController {
@property(nonatomic,retain) IBOutlet UIButton* newGameButton;
@property(nonatomic,retain) IBOutlet UIButton* statsButton;
@property(nonatomic,retain) IBOutlet UIButton* settingsButton;
CAKeyframeAnimation* popAnimation;
}
-(IBAction) newGame:(id)sender;
-(IBAction) showStats:(id)sender;
-(IBAction) showSettings:(id)sender;
@end
And the .m file (is its named implantation correct?):
#import "MainMenuViewController.h"
#import "TrafficAppDelegate.h"
#import "TrafficViewController.h"
@implementation MainMenuViewController
-(IBAction) newGame:(id)sender{
TrafficViewController* traffic = [[TrafficViewController alloc] initWithNibName:@"TrafficViewController" bundle:nil];
[self.navigationController pushViewController:traffic animated:NO];
}
-(IBAction) showStats:(id)sender{
}
-(IBAction) showSettings:(id)sender{
}
@synthesize newGameButton, statsButton, settingsButton;
-(void)viewDidLoad{
[super viewDidLoad];
popAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
popAnimation.keyTimes = [NSArray arrayWithObjects:[NSNumber numberWithFloat:0.0], [NSNumber numberWithFloat:0.7], [NSNumber numberWithFloat:1.0], nil];
popAnimation.values = [NSArray arrayWithObjects: [NSNumber numberWithFloat:0.01], [NSNumber numberWithFloat:1.1], [NSNumber numberWithFloat:1.0], nil];
[popAnimation retain];
}
-(void)popView:(UIView*)view{
[view setHidden:NO];
[[view layer] addAnimation:popAnimation forKey:@"transform.scale"];
}
-(void)viewWillAppear:(BOOL)animated{
[popAnimation setDuration:0.3];
[newGameButton setHidden:YES];
[statsButton setHidden:YES];
[settingsButton setHidden:YES];
[self performSelector:@selector(popView:) withObject:newGameButton afterDelay:0.25];
[self performSelector:@selector(popView:) withObject:statsButton afterDelay:0.3];
[self performSelector:@selector(popView:) withObject:settingsButton afterDelay:0.35];
}
@end
, . . script. script Xcode. . . - , script?