我的应用程序需要提醒msg并使用是按钮单击另一个警报消息,它决定最终操作。 我使用过 - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex 这种方法。
请帮帮我。
答案 0 :(得分:1)
做@Adrian Pirvulescu所说的但是在显示警报之前做alert.tag = 1;
然后在调用- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
时做:
if (alertView.tag == 1) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"2nd Alert"
message:@"My message" delegate:self cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK", nil];
alert.tag = 2;
[alert show];
[alert release];
}
else if (alertView.tag == 2) {
[self CallSomeMethod];
}
else {
//do what ever you want here
}
答案 1 :(得分:0)
检查一下 http://www.timeister.com/2010/06/objc-show-alert-iphone/
// open a alert with an OK and cancel button
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView"
message:@"My message" delegate:self cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK", nil];
[alert show];
[alert release];