我面临以下问题,我试图呈现一个 modalViewController 并使其覆盖整个屏幕,例如:
[controller setWantsFullScreenLayout:yes];
[myNavController presentModalViewController:controller animated:yes];
结果是 Controller 没有覆盖整个屏幕,状态栏在顶部可见。 我真的不明白为什么会这样。
最佳答案
wantsFullScreenLayout
属性不会隐藏状态栏,它使 View Controller 位于它的后面(并且也位于导航栏之类的东西后面)。这方面的一个例子是内置的照片应用程序,其中一张图片出现在状态和导航栏的后面:
要使模态视图 Controller 全屏,您需要设置 modalPresentationStyle
将 View Controller 的属性设置为 UIModalPresentationFullScreen
。启用此功能后,您可能不需要或不想设置 wantsFullScreenLayout
。
要隐藏状态栏,您需要使用 setStatusBarHidden:withAnimation:
UIApplication
的方法。
关于ios wants FullScreenLayout 状态栏可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13455472/