ios - UIModalViewController StatusBar背景颜色

标签 ios objective-c uinavigationbar statusbar

我使用宏颜色通过外观设置了UINavigationBar背景色调:

[[UINavigationBar外观] setBarTintColor:UIColorFromRGB(0x6DBEE8)];

在整个基于导航的应用程序中,但在我的 UIModalViewController 中不起作用:

在我的plist中,我有:查看基于 Controller 的状态栏外观:是

我在全局设置了appearance:[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

这是它的样子: enter image description here

最佳答案

那是因为在 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/

相关文章:

ios - 隐藏导航栏导致 View 向上移动

ios - 如何设置 UISegmentedControl 框架?

iphone - UIDocumentsInteractionController 显示 iBooks 但不打开它

css - 居中对齐导航项

swift - 动画导航栏颜色

iphone - UIToolbar 中的持久 UIBarButtonItem?

objective-c - 重新启动应用程序的按钮

ios - Xcode 5.1 : Remove x86_64 architecture

ios - 将 NSDate 存储在 CoreData 中

ios - GCDAsyncSocket 客户端/服务器无法通过 iOS 访问点工作