gpt4 book ai didi

iphone - UIAlertView 不等待

转载 作者:太空狗 更新时间:2023-10-30 03:58:08 25 4
gpt4 key购买 nike

我在我的代码中使用多个 UIAlertViews,如下所示

-(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(消息)并等待直到单击确定按钮。

从逻辑上讲,我想查看 myAlertView1(消息)并等到单击确定按钮,然后查看 myAlertView(错误)并等到单击按钮。我在这里遗漏了什么吗?

最佳答案

UIAlertView 并不像人们预期的那样是模态的。在创建和显示第二个 UIAlertView

之前,您应该等待您的代表收到 alertView:didDismissWithButtonIndex:

关于iphone - UIAlertView 不等待,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/882075/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com