Xcode脚本问题

时间:2011-03-19 02:26:30

标签: iphone objective-c xcode

在我的脚本中的.m文件中,我不断收到类似错误的错误:

  

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

1 个答案:

答案 0 :(得分:0)

你有这条线:

@synthesize newGameButton, statsButton, settingsButton;

你没有向我们展示接口(.h)文件,但我愿意打赌你没有newGameButton,statsButton或settingsButton的@property声明。那些应该看起来像:

@property(retain, nonatomic) UIButton *newGameButton;

除非它们应该是出口,在这种情况下,您还希望在IBOutlet

之前加入UIButton...