2011-03-19 133 views
0

在我的腳本.m文件我不斷收到類似這樣的錯誤錯誤:麻煩和Xcode腳本

no declaration of property "newGameButton" found in interface

我也與「statsButton」和「settingsButton」得到這個。這裏是我的腳本:

#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 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"]; 
} 

@end 
+0

什麼是你'@ interface'塊之前,包括IBOutlet這個班的樣子是? – Anomie 2011-03-19 02:36:33

回答

0

你一定行:

@synthesize newGameButton, statsButton, settingsButton;

您還沒有我們所示的界面(.h)文件中,但我願意打賭您沒有針對newGameButton,statsButton或settingsButton的@property聲明。這些應該是這個樣子:

@property(retain, nonatomic) UIButton *newGameButton;

,除非他們應該是網點,在這種情況下,你想也想只是UIButton...