Man*_*ish 4 iphone objective-c
我在我的代码中使用多个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;
}
Run Code Online (Sandbox Code Playgroud)
当我在模拟器中运行程序时,我看到myAlertView1(消息)短暂,它没有等待Ok按钮单击然后我看到myAlertView(错误)等待Ok按钮单击,然后我再次看到myAlertView1(消息),它等待,直到确定按钮点击.
从逻辑上讲,我想看 myAlertView1(消息)并等到单击确定按钮,然后看到myAlertView(错误)并等到按钮被单击.我在这里错过了什么吗?
rpe*_*ich 12
UIAlertView不是人们所期望的模态.alertView:didDismissWithButtonIndex:在创建和显示第二个代码之前,您应该等待代表接收UIAlertView
| 归档时间: |
|
| 查看次数: |
4826 次 |
| 最近记录: |