ios wants FullScreenLayout 状态栏可见

标签 ios fullscreen modalviewcontroller

我面临以下问题,我试图呈现一个 modalViewController 并使其覆盖整个屏幕,例如:

[controller setWantsFullScreenLayout:yes];
[myNavController presentModalViewController:controller animated:yes];

结果是 Controller 没有覆盖整个屏幕,状态栏在顶部可见。 我真的不明白为什么会这样。

最佳答案

wantsFullScreenLayout 属性不会隐藏状态栏,它使 View Controller 位于它的后面(并且也位于导航栏之类的东西后面)。这方面的一个例子是内置的照片应用程序,其中一张图片出现在状态和导航栏的后面:

enter image description here

要使模态视图 Controller 全屏,您需要设置 modalPresentationStyle将 View Controller 的属性设置为 UIModalPresentationFullScreen。启用此功能后,您可能不需要或不想设置 wantsFullScreenLayout

要隐藏状态栏,您需要使用 setStatusBarHidden:withAnimation: UIApplication 的方法。

关于ios wants FullScreenLayout 状态栏可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13455472/

相关文章:

iOS - 在模态视图 Controller 上设置 UISwitch 开/关状态

ios - Swift - 在另一个协议(protocol)中默认实现协议(protocol)函数

ios - 标签约束不起作用

ios - 在长时间计算期间保持 UITableView 平滑滚动

java - 仅一个窗口的全屏独占模式按键输入

ios7 - 在 iOS 7 中的模态视图或表单中显示 UIImagePickerController?

ios - IOS订阅

javascript - onfullscreenchange DOM 事件

Mac OSX 上的 Java - 检测程序是否全屏

objective-c - 如何一次关闭 3 个模态视图 Controller ?