本文介绍了UIAlert查看 - 是/否条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序需要提醒msg并使用是按钮单击另一个警报消息,它决定最终操作。
我用过 - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
这个方法。

my app needs alert msg and with yes button click another alert msg which decides the final action.I have used - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndexthis method.

请帮助我。

推荐答案

做什么@Adrian Pirvulescu说但在显示警告之前做 alert.tag = 1; 然后当 - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex 被调用do:

Do what @Adrian Pirvulescu said but before showing the alert do alert.tag = 1; and then when - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex is called do:

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
}

这篇关于UIAlert查看 - 是/否条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 20:47