我试图让我的UIAlert在单击按钮时执行两个不同的操作。当用户点击重新启动时,游戏重新开始,当主菜单被点击时,游戏应该进入主菜单。重置按钮工作正常,但IBAction不断给我提供有关切换视图的错误。将IBAction添加到UIAlert
// called when the player touches the "Reset Game" button
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
// the user clicked one of the OK/Cancel buttons
if (buttonIndex == 0)
{
[self resetGame];
}
else
{
- (IBAction)showFlip:(id)sender {
Menu *menuView = [[[menu alloc] init] autorelease];
[gameView setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:menuView animated:YES];
}
}
}
重置工作正常,但我得到IBAction两个错误。 'showFlip'未声明(首次在此函数中使用)和期望';'之前':'令牌。不明白为什么会这样说,因为当我在alertview之外发布IBAction时,它工作正常。 任何帮助,将不胜感激,在此先感谢
谢谢!这样做的窍门,因为你可能会告诉我这个东西很新。 – MacN00b
@ MacN00b乐于助人。 – PengOne