我已经创建了一个警报视图使用下面的代码两个按钮:委托方法“clickedButtonAtIndex:”不叫
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle: title
message: msg delegate:nil cancelButtonTitle:@"Replay" otherButtonTitles:@"Highscore", nil];
[alertView show];
我想,当点击一个按钮来运行一些代码。 为了做到这一点,我已经添加下面的方法到delegate.m文件:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex==0) //Run some code
else //Other code
}
但是这种方法不叫当我按下任一按钮! 有人能告诉我为什么吗?
由于提前,
Sagiftw
感谢您的帮助!我忘了! =) – Sagiftw 2010-03-29 13:25:27
Thanx我也被遗忘了。 – iBapu 2012-07-09 11:04:58