UIAlertView不显示 [英] UIAlertView not showing
问题描述
我的一个UIAlertViews有一个小问题.我正在尝试显示它,执行一些任务,然后自动将其关闭.这是我当前正在使用的代码:
I have a small problem with one of my UIAlertViews. I'm trying to show it, do some tasks, and then dismiss automatically. This is the code I'm using currently:
callingTaxi = [[UIAlertView alloc] initWithTitle:@"" message:@"検索中" delegate:nil cancelButtonTitle:nil otherButtonTitles:nil, nil];
[callingTaxi show];
/* Do some tasks */
[callingTaxi dismissWithClickedButtonIndex:0 animated:YES];
[callingTaxi release];
但是,UIAlertView仅显示一半.我可以看到背景变暗,但是在任务完成后,警报视图迅速出现,然后又消失了.
However, the UIAlertView only shows half-way. I can see the background darken, but then after the tasks have completed, the alert view quickly appears and then disappears, again.
有什么想法可以解决这个问题吗?
Any ideas how to solve this issue?
本
推荐答案
它确实显示了,但是您可以立即将其关闭,而不必等待用户使用它来做某事
It does show, but you dismiss it right away, instead of waiting for the user to do something, with
[callingTaxi dismissWithClickedButtonIndex:0 animated:YES];
iOS没有时间完全渲染它.无论如何,这不是应该使用dismissWithClickedButtonIndex的方式.您想在这里实现什么?
There is no time for iOS to render it completely. Anyway, this is not how dismissWithClickedButtonIndex is supposed to be used. What are you trying to achieve here?
我想您需要为UIAlertView分配一个委托,并让委托处理AlertView内部发生的事情.
I guess you need to assign a delegate to the UIAlertView, and let the delegate handle what happens inside the AlertView.
这篇关于UIAlertView不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!