我的游戏中有一层。在游戏结束时,我想向用户显示一个 UIAlertView 以重新启动或退出游戏。但它不起作用。我还获得了委托 UIAlertViewDelegate 进行分层。
任何解决方案?
我的代码如下,
-(void)gameFinished{
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
[self unschedule:@selector(checkForCollision)];
[self unschedule:@selector(dropObject)];
[self stopBackgroundMusic];
[self startNewForegroundMusic:@"GameOver" ofType:@"caf"];
[self playForegroundMusic];
[[Director sharedDirector] pause];
UIAlertView *view=[[UIAlertView alloc] initWithTitle:@"Game Finished" message:@"Want to play again?" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes"];
[view show];
[view release];
}