【发布时间】:2015-10-15 19:20:11
【问题描述】:
在 iOS8 之前,我必须在一个 viewController 中显示多个 UIAlerts,我们可以使用带有标签的 UIAlerts,我们可以使用类似标签在 clickedButtonAtIndex 中进行识别。
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(alertView.tag == 1)
{
//UIAlert1 button clicked
}
if(alertView.tag == 2)
{
//UIAlert2 button clicked
}
}
所以我们可以做一些事情。 如何识别不同 UIAlertControllers 的按钮点击。 因为一个 alert1 按钮单击我必须更改一些文本颜色和 alert2 按钮单击我必须弹出视图控制器。
【问题讨论】:
-
这是个好问题
-
在这里查看我的答案:stackoverflow.com/a/38875376/3412051
标签: ios iphone uialertcontroller