为什么显示UIAlertView必须在线程的末尾

时间:2021-04-24 11:34:41

I'm confused, I want to popup a UIAlertView on the screen. But I find UIAlertView popup just after the whole codes complete or I invoke NSTimer. I want to know the reason about it. Is there anyway let me to control the view visiblility?

我很困惑,我想在屏幕上弹出一个UIAlertView。但是我发现UIAlertView在整个代码完成或者我调用NSTimer之后。我想知道原因。是否允许我控制视图的可视性?

1 个解决方案

#1


0  

You should not call any UI methods from a thread other than the main thread. Set up your alert, and use performSelectorOnMainThread to display it.

您不应该从主线程以外的线程调用任何UI方法。设置警报,并使用performSelectorOnMainThread显示它。

#1


0  

You should not call any UI methods from a thread other than the main thread. Set up your alert, and use performSelectorOnMainThread to display it.

您不应该从主线程以外的线程调用任何UI方法。设置警报,并使用performSelectorOnMainThread显示它。