我有一款游戏,当您松动时,我试图回到主屏幕。当你松动时,这段代码会运行,但是当我在代码的末尾取消注释行时,它会在我尝试运行时给我一个错误。视图控制器和分类主屏幕和游戏是不同的。我在网上找不到任何可以工作的东西。使用代码切换视图控制器
-(void)resetAll {
[randomMain invalidate];
CGRect frame = [player frame];
frame.origin.x = 137.0f;
frame.origin.y = 326.0;
[player setFrame:frame];
CGRect frame2 = [enemy frame];
frame2.origin.x = 137.0f;
frame2.origin.y = 20.0;
[enemy setFrame:frame2];
[NSObject cancelPreviousPerformRequestsWithTarget:self];
[timerImageView stopAnimating];
[email protected]"";
int sum = [lastRoundCash intValue] + [playerCash intValue];
playerCash = [NSString stringWithFormat:@"%d", sum];
[self performSelector:@selector(save) withObject:nil afterDelay:0];
[self performSelector:@selector(updateLabelState) withObject:nil afterDelay:0];
[freezeUseOutlet setHidden:true];
int x = [lastRoundRound floatValue];
int y = [highScore floatValue];
if (x>y) {
highScore=lastRoundRound;
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"New High Score!" message:[NSString stringWithFormat:@"You beat your high score! Your high score is now %@!",highScore] delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
[alert show];
[self performSelector:@selector(updateLabelState) withObject:nil afterDelay:0];
[self.navigationController pushViewController:ViewController animated:YES];
}
}
我在代码中看不到注释行。 – 2013-03-23 18:58:52