简体   繁体   中英

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).

Thanks.

Are you on pre-iOS 4?

In iOS 4+, alerts are not dismissed automatically when the app goes to the background. 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:

Important: In iOS 4.0 and later, alert views are not dismissed automatically when an application moves to the background. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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