Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fullscreen UIView with Status bar and Navigation Bar overlay on the top

What is the proper way to implement the status bar and navigation bar that go on top of an UIView?

alt text http://img.skitch.com/20081217-t78sdixk37hqgdh1ia2fgec4st.png

like image 686
leonho Avatar asked Dec 17 '08 06:12

leonho


3 Answers

Just set “wants fullscreen layout” in your view controller. That solves the problem for me.

self.wantsFullScreenLayout = YES;
like image 52
Jonathan Sterling Avatar answered Oct 30 '22 15:10

Jonathan Sterling


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;
like image 23
August Avatar answered Oct 30 '22 15:10

August


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.

like image 14
Unfalkster Avatar answered Oct 30 '22 15:10

Unfalkster