iOS 7 multitasking switcher: Navbar appears black

后端 未结 2 513
名媛妹妹
名媛妹妹 2021-02-05 21:19

The preview window/multitasking switcher shows a weird behaviour in iOS 7. Here is how it appears when I set this property for both apps.

self.navigationControl         


        
相关标签:
2条回答
  • 2021-02-05 21:54

    Instead of doing it in code, you can also do it via Storyboard.

    In the navigation bar of your root navigation bar, make sure you turn off its translucency.

    enter image description here

    I reckon it's a simpler solution.

    0 讨论(0)
  • 2021-02-05 22:05

    I ran into this as well. Since you don't have any content under the translucent navigation bar (and/or tab bar or tool bar), it can sometimes appear black in the app switcher. I was using a collection view that was constrained to the top and bottom layout guides and so there was nothing behind the tab bar and navigation bar. When the app is in the foreground it looks correct because there must be some default background color applied by Apple (maybe on the UIWindow) so you don't see through to the springboard. This background color seems to be gone (or black) when in the app switcher causing it to look like that.

    The problem goes away on view controllers that are set to extend under top and/or bottom bars:

    self.edgesForExtendedLayout = UIRectEdgeTop | UIRectEdgeBottom;

    or in Interface Builder:

    enter image description here

    If that doesn't fit you needs or you still have other view controllers that don't extend under top and bottom bars you will still get the black bars in the app switcher. The way I solved it was to set the UIWindow background color in my appDelegate.

    self.window.backgroundColor = [UIColor whiteColor];

    0 讨论(0)
提交回复
热议问题