Trouble with Xcode Script
In the .m file in my script i keep getting an error like this error:
no declaration of property "newGameButton" found in interface
I also get this with the "statsButton" and "settingsButton". here is my script:
#import "MainMenuViewController.h"
#import "Traffic_2AppDelegate.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 {
}
- (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];
}
@synthesize n开发者_运维百科ewGameButton, 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"];
}
@end
You've got the line:
@synthesize newGameButton, statsButton, settingsButton;
You haven't shown us the interface (.h) file, but I'd be willing to bet that you don't have a @property declaration for newGameButton, statsButton, or settingsButton. Those should look something like:
@property(retain, nonatomic) UIButton *newGameButton;
unless they're supposed to be outlets, in which case you'd also want to include IBOutlet
just before the UIButton...
精彩评论