8

So I'm having a weird issue with the new large titles in iOS 11. Instead of me trying to badly and confusingly explain the issue here is a 10-second screen recording of what is happening:

Screen recording of issue on YouTube

As you can see there is a weird black bar that appears when transitioning between a view controller that has

navigationItem.largeTitleDisplayMode = .never

And one that is set to .always

Thanks in advance!

jackchmbrln
  • 1,672
  • 2
  • 14
  • 26

2 Answers2

22

Before the transition set this:

self.navigationController?.view.backgroundColor = .white
Pranav Kasetti
  • 8,770
  • 2
  • 50
  • 71
3

As Pranav said, the issue here is the background colour of the navigation controller's view, however, changing that from a child view controller is not the perfect way to do it.

Instead, a better way is to subclass UINavigationController and in the viewDidLoad() set the

override func viewDidLoad()
{
  super.viewDidLoad()
  view.backgroundColor = .white
}

Then, just use your custom subclass rather than the standard UINavigationController. This way, you only ever need this code in one place.

Pranav Kasetti
  • 8,770
  • 2
  • 50
  • 71
Dave Verwer
  • 6,140
  • 5
  • 34
  • 30