简体   繁体   中英

What would cause the iPhone home screen to be visible behind a modal flip transition?

On some occasions, not every time, when my app presents a modal view controller using presentModalViewController:animated: with modalTransitionStyle set to UIModalTransitionStyleFlipHorizontal the iPhone home screen is visible behind the animation. Most of the time the background is black as expected. There is nothing abnormal where I set up the window or rootViewController (a UITabBarController ). I blacked out my app UI but you can see the issue in the screen shot taken with an iPhone 4 while the transition is in progress.

What would cause this? I don't know how to do it even if I wanted this behavior.

EDIT: This screen shot was sent to me by a tester, I haven't repro'ed it myself. They told me it occurred during a particular app session and once it occurred it happened for all transitions. When they quit/relaunched the app it didn't happen again and they haven't seen it since. I'm wondering whether it's something I need to be concerned about (ie I can prevent it in code).

EDIT 2: This app does not use IB. All controllers/views are created in code.

在此输入图像描述

I've had the same problem before. Try using [viewController.view setBackgroundColor:[UIColor blackColor]]; on the view your pushing. Worked for me anyways!

This happens when iOS sends memory warning to the app and the app's framework automatically dumps all the view components which are not visible, except the data structures related to the viewController will stay, and when there is a refer to the view it will load the view from the nib again ( in your case loadView is called I guess) you should make sure your view construction code is reconstructable and nullify all objects related to the view components in viewDidUnload method of your view controller.

You can also make it happen by running your app by simulator and when you are in that modal view, trigger the "Memory Warning" simulation from the "Device" menu on the top of your computer screen.

Instructions to fixing this problem:

  1. Go to the effected XIB and select the View Controller effected.
  2. Go to the attributes panel on the right. Go to View >> Background colour.
  3. Now set the colour you want to back the transition.

Hope this helps :)

I'm not sure but I think this may be caused by a bug or modification to the main 'UIApplication.h' code, a problem with the iOS or an issue with the version of Xcode you have.

Seb

I saw this issue happening even with Facebook iPhone App. Maybe it is Apple's bug.

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