Fullscreen UIView with Status bar and Navigation Bar overlay on the top
Just set “wants fullscreen layout” in your view controller. That solves the problem for me.
self.wantsFullScreenLayout = YES;
In the screenshot above, there's a translucent status bar and a translucent navigation bar.
The status bar is set using
[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleBlackTranslucent];
The navigation bar is set using
theNavigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
If you have a view controller inside a navigation controller, and you want to hide the status bar in order to have your viewController's view in full screen, you can always call :
[self.navigationController.view setNeedsLayout];
after hiding the status bar. But I personally think
[self setWantsFullScreenLayout:YES];
is a better way.
The best way I came up was this: when using a "complex" hierarchy of Tab bar containing navigation controllers, with one "detail" view being a full screen view.
In the app delegate just before the tab bar controller's view is added to the window, I added this:
tabBarController.view.frame = [[UIScreen mainScreen] bounds];
This will make the tab bar controller cover the entire screen, even below the area of the status bar. I had to offset heights of several views to +20px, notably the navigation bars.