How to set an iOS app for iPad to fullscreen programmatical开发者_高级运维ly?
Are you talking about the status bar which is visible? In the info.plist for your app, you can add a new entry, UIStatusBarHidden and make sure its checked. This would ensure that the status bar is hidden. You also have to make sure that your views are able to handle the additional screen real estate also.
Nowadays (since IOS7) in order to do this you need to override a small tiny lily method of each UIViewController you want to do this
Swift
override func prefersStatusBarHidden() -> Bool {
return true;
}
Objective C
-(BOOL)prefersStatusBarHidden{
return YES;
}
Apple Doc:
Maybe you want this one:
[self setWantsFullScreenLayout:YES];
just add it at your viewController's init method.
Someone else may need it. ;)
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
(other animation modes are ...Fade and ...Slide.)
You need to override var rather func,
override var prefersStatusBarHidden: Bool {
return true
}
精彩评论