0

I have a HomeViewController which pushes to SendViewController and the navigation bar turns from dark blue to white:

In HomeViewController.swift:

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    navigationController?.navigationBar.barStyle = .black
    navigationController?.navigationBar.barTintColor = Styleguide.Colors.darkBlue.color
    navigationController?.navigationBar.tintColor = Styleguide.Colors.lightBlue.color
}

 override func viewDidLoad() {
    super.viewDidLoad()

    view.backgroundColor = Styleguide.Colors.darkBlue.color

    navigationController?.navigationBar.barTintColor = Styleguide.Colors.darkBlue.color
    navigationController?.navigationBar.tintColor = Styleguide.Colors.lightBlue.color
    navigationController?.navigationBar.isTranslucent = false
    navigationController?.navigationBar.shadowImage = UIImage() // hides the bottom border
    self.navigationItem.hidesBackButton = true
    ... more 
}

In SendViewController.swift:

override func viewWillAppear(_ animated: Bool) {
   super.viewWillAppear(animated)
   self.navigationController?.navigationBar.barStyle = .default
}

override func viewWillDisappear(_ animated: Bool) {
   super.viewWillDisappear(animated)
   self.navigationController?.navigationBar.barStyle = .black
}

override func viewDidLoad() {
    super.viewDidLoad()

    view.backgroundColor = .white

    self.navigationController?.navigationBar.barTintColor = .white
    self.navigationController?.navigationBar.tintColor = Styleguide.Colors.darkBlue.color
    ... more
}

Here's the problem:

When popping from Send to Home, the navigation bar is white and then jumps to be dark blue after animation finishes. (Desired result is an animation from white to dark blue as the pop happens)

Zack Shapiro
  • 6,648
  • 17
  • 83
  • 151
  • I had a similar problem check out my post, the answers helped me: https://stackoverflow.com/q/44343355/3900902 – Paulo Jan 20 '18 at 13:31
  • check this post may help https://stackoverflow.com/questions/39835420/navigationbar-delay-updating-bartintcolor-ios10/40255483#40255483 – Joe Jan 21 '18 at 16:05

1 Answers1

0

Try adding

 navigationController?.navigationBar.barTintColor = Styleguide.Colors.darkBlue.color
 navigationController?.navigationBar.tintColor = Styleguide.Colors.lightBlue.color

to viewWillDissapear of SendViewController

Andrew McKinley
  • 1,137
  • 1
  • 6
  • 11
  • I have. It makes no difference. The bar is still white until the pop animation finishes, then jumps to dark blue. Hence my confusion. – Zack Shapiro Jan 19 '18 at 21:06