开发者

Check whether status bar is hidden or visible

开发者 https://www.devze.com 2023-03-28 05:09 出处:网络
I want to check condition for statusbar. How can i check condition if status bar is visible or not . pl开发者_运维百科ease anyone guide me to do this..

I want to check condition for statusbar. How can i check condition if status bar is visible or not .

pl开发者_运维百科ease anyone guide me to do this..

Thank you all


Check if status bar is hidden:

Objective C:

if ([UIApplication sharedApplication].isStatusBarHidden) {
    // do stuff here...
}

Swift:

if UIApplication.shared.isStatusBarHidden {
    // do stuff here...
}

Hide status bar:

override var prefersStatusBarHidden: Bool {
    return true
}


Swift 3

if UIApplication.shared.isStatusBarHidden {
    // Do something
}

To hide the status bar (setStatusBarHidden is deprecated in iOS 9) override in your ViewController:

override var prefersStatusBarHidden: Bool {
    return true
}


You can check the current state by using the statusBarHidden property of [UIApplication sharedApplication]

You can set the current state using – setStatusBarHidden:withAnimation:

See the docs for more awesome stuff.

HTH


U can Also check this in xib of interface builder in view attributes u can see four options for it gray/ black/ translucent/ unspecified..

0

精彩评论

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