2 带有 3 个按钮的 UIAlertView? [英] 2 UIAlertView with 3 buttons?

查看:27
本文介绍了2 带有 3 个按钮的 UIAlertView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何制作 2 个带有 3 个按钮的 UIAlertView,UIAlertViews(2) 需要不同,选项和操作...如何???

I wanna know how can I make 2 UIAlertView, with 3 buttons, the UIAlertViews(2) needs be different, the options and the actions... how ???

推荐答案

试试这个:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Welcome" message:@"Message." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:@"Button 2", @"Button 3", nil];
alert.tag = 1;               
[alert show];

然后对下一个alertView做同样的事情,只需将标签更改为2

then do the same for the next alertView, just change the tag to 2

然后运行这个方法

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
     if(alert.tag == 1) {
          //the alert tag 1 was just closed - do something
     }
}

另外 - 确保包含 UIAlertViewDelegate

这篇关于2 带有 3 个按钮的 UIAlertView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆