Joe
Joe

Reputation: 8986

NavigationBar barStyle not changing in Xcode 8

I have a navigationBar and toolbar running in my project in the same view controller. I was using the barStyle to customise the look of navigation & toolbar in Swift 2 as follows:

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

    // Navigation style and Apperance
    // ------------------------------

    navigationController!.navigationBar.barStyle = UIBarStyle.blackOpaque
    navigationController!.navigationBar.tintColor = UIColor.white
    navigationController!.navigationBar.isTranslucent = true

    navigationController!.toolbar.barStyle = UIBarStyle.blackOpaque
    navigationController!.toolbar.tintColor = UIColor.white
    navigationController!.toolbar.isTranslucent = true
}

Everything worked and the bars look transparent.But, After I updated my Xcode 7 to Xcode 8.my navigation and toolbar went black for some reason ?

Thanks in Advance...

Upvotes: 1

Views: 897

Answers (1)

midori
midori

Reputation: 450

Here is my snippet which should work with XCode 8 (& Swift 3):

navController.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
navController.navigationBar.shadowImage = UIImage()
navController.navigationBar.isTranslucent = true
navController.navigationBar.tintColor = UIColor.white

Upvotes: 1

Related Questions