隐藏 UIStatusBar 会在屏幕上留下空的蓝色条
我有一个纵向 iPhone 应用程序,它有一个隐藏的导航栏,控制视图之间的流程。在一个视图中,我需要将视图旋转 90 度为横向,并且我想隐藏状态栏。
问题在于,虽然状态栏被正确隐藏,但它在状态栏所在的屏幕顶部留下了一个空的浅蓝色栏。我的视图实际上位于该栏下方,填满了屏幕。
我尝试过调整视图的大小,但它已经设置为屏幕的完整大小。看来这个蓝色条超出了我的视野。
难道是因为我把导航栏和状态栏都隐藏了?
任何帮助,非常感谢。
邓克
I have a portrait iPhone app, which a hidden navigation bar controlling the flow between views. In one view, I need to rotate the view 90 degrees to landscape, and I want to hide the status bar.
The problem is that whilst the status bar is correctly hidden, it leaves an empty light-blue bar across the top of the screen where the status bar was. My view actually sits under this bar, filling the screen.
I've tried playing with the size of the view, but its already set to the full size of the screen. It seems this blue bar is ABOVE my view.
Could it be because I have hidden both the navigation bar and the status bar?
Any help, much appreciated.
Dunc
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用隐藏导航栏的 UINavigationController(UINavigationBar 本身不执行任何操作),那么您需要调整窗口中的导航控制器框架,而不是视图的框架导航控制器中的控制器视图。这是您的视图层次结构:
当您隐藏状态栏时,请在视图控制器中尝试此操作:
或者,如果您想使用窗口的框架:
If you're using a UINavigationController with its navigation bar hidden (a UINavigationBar does nothing on its own), then you need to adjust the navigation controller's frame in the window, not the frame of your view controller's view in the navigation controller. Here's your view hierarchy:
Try this in your view controller when you hide the status bar:
Or, if you want to use the window's frame: