How to enable large titles in your navigation bar

iOS 11 introduced a new design for navigation bar titles, allowing developers to enable large titles for view controllers that needed to be particularly prominent.

By default these large titles are disabled, but you can enable them with one line of code in your navigation controller’s top view controller:

navigationController?.navigationBar.prefersLargeTitles = true

That will enable large titles for all view controllers that subsequently get pushed, but you can be more selective by adjusting the navigationItem.largeTitleDisplayMode property of your view controllers.

For example, if you wanted subsequent view controllers to never use large titles, you would put this into their viewDidLoad() method:

navigationItem.largeTitleDisplayMode = .never

Sponsored You’re already busy updating your app for Swift 4.2 and iOS 12, so why not let Instabug help you find and fix bugs? Add just two lines of code to your project and receive comprehensive reports with all the feedback you need to ship a world-class app – click here to learn more!