iOS 11 prefersLargeTitles Weird Transition

Viewed 3433

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!

2 Answers

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.

Related