Igor Kulman

Fixing black artifact when changing large titles mode in iOS11

· Igor Kulman

One of the new features of iOS 11 is the ability to display large headers in the navigation bar by setting the prefersLargeTitles property to true. You can set it for the whole app (using the UIAppearance for example) or differently for each view controller.

But there is a problem. If you navigate from a view controller with large titles enabled to a view controller with large titles disabled, you will see a black artifact under the change animation:

Black navigation artifact

The black artifact comes from the navigation controller. If you set the backgroundColor of the navigation controller’s view to any, like red, it will replace the black artifact with an artifact of that color. The solution is to set the color of the color of you UI, white in my case:

Black navigation artifact fixed

Now the animation looks ok, no visible artifact. The problem is, you cannot set it globally using UIAppearance, so you can either set navigationController.view.backgroundColor = UIColor.white on every navigation controller in your app, or create a custom navigation controller inheriting from UINavigationController and use it everywhere where needed.

See also