我使用宏颜色通过外观
设置了UINavigationBar
背景色调:
[[UINavigationBar外观] setBarTintColor:UIColorFromRGB(0x6DBEE8)];
在整个基于导航的应用程序中,但在我的 UIModalViewController
中不起作用:
在我的plist
中,我有:查看基于 Controller 的状态栏外观:是
我在全局设置了appearance
:[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
这是它的样子:
最佳答案
那是因为在 iOS7 中,UINavigationBar
的高度在包含在 UINavigationController
中时会增加(64 点)。由于状态栏是透明的,当您以模态方式呈现 View Controller 时,它不在 UINavigationController
中,因此高度正常(44 点),因此 map View 位于状态栏后面。您需要在模态视图 Controller 中处理此问题。您可以:
- 完全隐藏状态栏(有效但可能不适合 每一种情况)
- 在导航栏后面和状态栏所在的位置放置一个 View 相同的背景颜色。
- 将 View Controller 的 View 本身的颜色更改为所需的颜色,并且 偏移 map View 的 y 位置以适应状态 栏的高度。
关于ios - UIModalViewController StatusBar背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23152438/