hide the statusbar

…衆ロ難τιáo~ 提交于 2019-12-14 01:39:54

问题


I hope to display the view of one of ViewControllers in my app as full screen , so in Interface Builder, I set the statusbar as None. I also resize the frame of view as 320*480

but when I run the app, the view of the viewcontroller still displays the statusbar.

Welcome any comment

thanks


回答1:


Call setStatusBarHidden:withAnimation: on [UIApplication sharedApplication].




回答2:


it is not diffult to solve the problem. In your project setting plist file, check the key"Status bar is initially hidden", status bar will be removed from startup.




回答3:


You need to set your view controller's wantsFullScreenLayout to YES. Make your xib file as big as the screen and set this in your viewDidLoad.

wantsFullScreenLayout

A Boolean value indicating whether the view should underlap the status bar.

@property(nonatomic, assign) BOOL wantsFullScreenLayout

Discussion

When a view controller presents its view, it normally shrinks that view so that its frame does not overlap the device’s status bar. Setting this property to YES causes the view controller to size its view so that it fills the entire screen, including the area under the status bar. (Of course, for this to happen, the window hosting the view controller must itself be sized to fill the entire screen, including the area underneath the status bar.) You would typically set this property to YES in cases where you have a translucent status bar and want your view’s content to be visible behind that view.

If this property is YES, the view is not resized in a way that would cause it to underlap a tab bar but is resized to underlap translucent toolbars. Regardless of the value of this property, navigation controllers always allow views to underlap translucent navigation bars.

The default value of this property is NO, which causes the view to be laid out so it does not underlap the status bar.

Availability Available in iOS 3.0 and later.

Declared In

UIViewController.h



来源:https://stackoverflow.com/questions/4002679/hide-the-statusbar

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