1

我有一个游戏,当你松开时,我正试图回到主屏幕。当您松开时,此代码块会运行,但是当我取消注释代码末尾的行时,它会在我尝试运行它时给我一个错误。主屏幕和游戏的视图控制器和分类是不同的。我在网上找不到任何有效的东西。

-(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];
    counter.text=@"";
    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];
    }
}
4

1 回答 1

0

我想你想弹出视图控制器。

于 2013-03-23T18:53:52.973 回答