iOS 7多任务切换器:Navbar显示为黑色 [英] iOS 7 multitasking switcher: Navbar appears black

查看:298
本文介绍了iOS 7多任务切换器:Navbar显示为黑色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

预览窗口/多任务切换器在iOS 7中显示了一种奇怪的行为。
以下是我为这两个应用设置此属性时的显示方式。

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.navigationController.navigationBar.translucent = NO;


现在对于白色应用程序我评论了该行。

Now for the white app I commented the line.

现在,当我再次运行它并直接转到切换台时,这就是我得到的:

Now when I run it again and go directly to the switcher, this is what I get:

如果我运行应用程序,然后转到主屏幕或任何其他应用程序,然后转到切换台,这就是我得到的:

If I run the app and then go to the home screen or any other app and then go to the switcher, this is what I get:

有半透明导航条时有没有办法解决这个问题?

Is there any way to correct this problem while having translucent navbar?

谢谢。

推荐答案

我也遇到了这个问题。由于您在半透明导航栏(和/或标签栏或工具栏)下没有任何内容,因此在应用切换器中有时会显示为黑色。我使用的是一个受限于顶部和底部布局指南的集合视图,因此标签栏和导航栏后面没有任何内容。当应用程序在前台时,它看起来是正确的,因为Apple必须有一些默认的背景颜色(可能在 UIWindow 上),所以你看不到跳板。在应用程序切换器中,此背景颜色似乎消失(或黑色),使其看起来像那样。

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;

或在Interface Builder中:

or in Interface Builder:

如果这不符合您的需要或你仍然有其他视图控制器没有在顶部和底部栏下延伸,你仍然会得到应用程序切换器中的黑条。我解决它的方法是在我的appDelegate中设置 UIWindow 背景颜色。

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];

这篇关于iOS 7多任务切换器:Navbar显示为黑色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆