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.
The
wantsFullScreenLayoutproperty 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
modalPresentationStyleproperty of your view controller toUIModalPresentationFullScreen. With this enabled, you probably don’t need or want to setwantsFullScreenLayout.To hide the status bar you need to use the
setStatusBarHidden:withAnimation:method ofUIApplication.