写作时
@implementation GameViewController
-(IBAction)StartGame:(id)sender{
StartGame.hidden = YES;
BirdMovement = [NSTimer scheduledTimerWithTimeInterval:0.05
target:self selector:@selector(BirdMoving) userInfo:nil repeats:YES];
}
-(void)BirdMoving{
Bird.center = CGPointMake(Bird.center.x, Bird.center.y - BirdFlight);
BirdFlight = BirdFlight - 5;
if (BirdFlight < -15) {
BirdFlight = -15;
if (BirdFlight > 0) {
Bird.image = [UIImage imageNamed:@"3.png"];
}
if (BirdFlight < 0) {
Bird.image = [UIImage imageNamed:@"4.png"];
}
}
-(void)touchesBegan:(NSSet *)touches withEvent: (UIEvent *)event{
BirdFlight =30;
}
它说我使用未声明的标识符touchesBegan:
请帮帮我:)。
答案 0 :(得分:0)
您忘记了}
方法中if (BirdFlight < -15)
语句的右大括号(BirdMoving
)。
在Xcode中,选择编辑&gt;选择全部(或按⌘ A )。然后选择编辑器&gt; <结构>重新缩进(或按 control I )。这将使问题变得明显。