eli*_*o.d 2 fullscreen modalviewcontroller ios
我面临以下问题,我试图呈现一个modalViewController并使其覆盖整个屏幕,例如:
[controller setWantsFullScreenLayout:yes];
[myNavController presentModalViewController:controller animated:yes];
Run Code Online (Sandbox Code Playgroud)
结果是控制器没有覆盖整个屏幕,状态栏在顶部可见.我真的不明白为什么会这样.
该wantsFullScreenLayout属性不会隐藏状态栏,它会使视图控制器在其后面布局(并且还会在导航栏之类的内容之后进行布局).一个例子是内置的照片应用程序,其中图片显示在状态和导航栏后面:

要使模态视图控制器全屏,您需要将modalPresentationStyle视图控制器的属性设置为UIModalPresentationFullScreen.启用此功能后,您可能不需要或不想设置wantsFullScreenLayout.
要隐藏状态栏,您需要使用setStatusBarHidden:withAnimation:方法UIApplication.