简体   繁体   中英

How to make the entire project's navigation bar black in Swift and iOS 9

I want to set the status bar as black for the entire project. I have Pagination, Modal views, Navigation stacks in my project. Is there a way to set the status bar a black for complete project. I've seen this in Android apps. I have tried to set status bar as Light in AppDelegate, have set View-Controllers based navigation bar to NO/YES in plist. Nothing seems to work.

Calling this form application:didFinishLaunchingWithOptions should work.

func setStatusBarBackgroundColor(color: UIColor) {
guard  let statusBar = UIApplication.sharedApplication().valueForKey("statusBarWindow")?.valueForKey("statusBar") as? UIView else {
    return
}

statusBar.backgroundColor = color
}

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