简体   繁体   中英

StatusBar Hidden Issue in IOS 9

I am having one issue using status bar. I am using stroyboard id to navigate from oneviewcontroller to secondViewcontroller . I want to hide second Viewcontroller Status bar, but its not hiding and OneViewcontroller has status bar not hidden. I am using iOS 9 , Swift 2.2 and Xcode 7.3.1

override func prefersStatusBarHidden() -> Bool {
    if statusBarIsVisible {
        return false
    } else {
        return true
    }
}

In your secondViewController add this method

override func prefersStatusBarHidden() -> Bool {
    return true
}

This will hide status bar on secondViewController

1.Go to Info.plist file

2.Hover on one of those lines and a (+) and (-) button will show up.

3.Click the plus button to add new key Type in start with capital V and automatically the first choice will be View controller-based status bar appearance.

4.Add that as the KEY. Set the VALUE to "NO"

5.Go to you AppDelegate.swift Add the code, inside the method

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject:AnyObject]?) -> Bool {
    application.statusBarHidden = true
    return true
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM