开发者

Set fullscreen mode in iOS programmatically

开发者 https://www.devze.com 2023-03-09 20:54 出处:网络
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, UIStatusBar

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:

Set fullscreen mode in iOS programmatically


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  
} 
0

精彩评论

暂无评论...
验证码 换一张
取 消