简体   繁体   English

iOS:显示UIAlert是否会破坏当前显示的模式视图控制器?

[英]iOS: Can displaying a UIAlert disrupt a currently displayed modal view controller?

I'm using modal full-screen view controllers, and I have them appearing on top of one another (at most 3). 我使用的是模态全屏视图控制器,并且它们彼此重叠(最多3个)。

Thanks. 谢谢。

Are you on pre-iOS 4? 您是否在iOS 4之前的版本上?

In iOS 4+, alerts are not dismissed automatically when the app goes to the background. 在iOS 4+中,当应用程序进入后台时,警报不会自动消除。 You do get notification that the app is going into the background so if there is any state you need to save you can do it then. 您会收到通知,通知该应用程序正在进入后台,因此如果需要保存任何状态,则可以执行此操作。 This behavior has nothing to do with modal view controllers (or how you present your view controller). 此行为与模式视图控制器(或如何显示视图控制器)无关。

From the UIAlertView docs: UIAlertView文档:

Important: In iOS 4.0 and later, alert views are not dismissed automatically when an application moves to the background. 重要提示:在iOS 4.0及更高版本中,当应用程序移至后台时,警报视图不会自动关闭。 This behavior differs from earlier versions of the operating system, where alert views were automatically cancelled (and their cancellation handler executed) as part of the termination sequence for the application. 此行为不同于早期版本的操作系统,在早期版本中,警报视图作为应用程序终止序列的一部分被自动取消(并执行了取消处理程序)。 Now, it is up to you to decide whether to dismiss the alert view (and execute its cancellation handler) or leave it visible for when your application moves back to the foreground. 现在,由您决定是关闭警报视图(并执行其取消处理程序)还是在应用程序返回到前台时将其保持可见状态。 Remember that your application can still be terminated while in the background, so some type of action may be necessary in either case. 请记住,您的应用程序仍可以在后台终止,因此在两种情况下都可能需要采取某种措施。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM