ios wantsFullScreenLayout statusbar visible

纵饮孤独 提交于 2019-12-04 14:29:10

问题


I'm facing the following problem, I trying to present a modalViewController and make it cover the entire screen, for example:

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

the result is that the controller does not cover the entire screen and the status bar is visible on top. I don't really understand why this happens.


回答1:


The wantsFullScreenLayout property does not hide the status bar, it makes the view controller get layed out behind it (and also get layed out behind things like navigation bars). An example of this is the built-in Photos app, where a picture appears behind the status and navigation bar:

To make a modal view controller full screen you need to set the modalPresentationStyle property of your view controller to UIModalPresentationFullScreen. With this enabled, you probably don't need or want to set wantsFullScreenLayout.

To hide the status bar you need to use the setStatusBarHidden:withAnimation: method of UIApplication.




回答2:


Try adding this:

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];

Also, if you want it hidden at all times and when the application starts, in your plist file, add Status bar initially hidden to YES.



来源:https://stackoverflow.com/questions/13455472/ios-wantsfullscreenlayout-statusbar-visible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!