UIAlertView不等待

编程入门 行业动态 更新时间:2024-10-26 18:16:46
本文介绍了UIAlertView不等待的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在代码中如下使用多个UIAlertViews

I am using multiple UIAlertViews in my code as follows

-(void) myfunc { myAlertView1 = [[UIAlertView alloc] initWithTitle:@"Message" message:[list objectAtIndex:1] delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [myAlertView1 show]; [myAlertView1 release], myAlertView1 = nil; { do something } myAlertView = [[UIAlertView alloc] initWithTitle:@"Error" message:[list objectAtIndex:1] delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [myAlertView show]; [myAlertView release], myAlertView = nil; }

当我在模拟器中运行程序时 我短暂地看到myAlertView1(消息),它不等待确定"按钮单击 然后我看到myAlertView(错误),它等待确定按钮的单击,然后我再次看到myAlertView1(消息),它一直等到单击确定按钮.

When I run the program in simulator I see myAlertView1 (Message) briefly and it does not waits for Ok button click then I see myAlertView (Error) which waits for Ok button click and after that I again see myAlertView1 (Message) and it waits till OK button is clicked.

从逻辑上讲,我想查看myAlertView1(消息)并等待,直到单击确定"按钮,然后再看到myAlertView(错误),并等待直到单击按钮. 我在这里想念什么吗?

Logically I want to see myAlertView1(Message) and wait till Ok button is clicked and then see myAlertView (Error ) and wait till button is clicked. Am I missing something here?

推荐答案

UIAlertView并不是人们期望的模态.在创建并显示第二个UIAlertView

UIAlertView is not modal as one might expect. You should wait for your delegate to recieve alertView:didDismissWithButtonIndex: before creating and showing the second UIAlertView

更多推荐

UIAlertView不等待

本文发布于:2023-11-06 10:00:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1563383.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:UIAlertView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!