How to enable large titles in your navigation bar

Navigation Bar

11 Jan 2022 . 2 min read       @gurjitpt


You can enable large titles in your navigation bar using prefersLargeTitles property. This property has boolean value true or false. When it's property value is true it indicates that title will be shown in large font format. When it's value is false means it will displays inline. You can enable large title with a single line of code.


navigationController?.navigationBar.prefersLargeTitles = true


You can also configure the title's appearance using largeTitleDisplayMode property. If you don't want to use large title then add following code to viewDidLoad() method.


navigationItem.largeTitleDisplayMode = .never


However, you can also enable large title using storyboard. Select navigation bar and in attribute inspector enable Prefers Large Titles.

Generic placeholder image

Don’t hesitate to contact me if you have any questions or queries. Follow me on twitter @gurjitpt for any updates.

Thanks!

Related articles:


Share this article


Generic placeholder image

WRITTEN BY

Gurjit Singh

I’m Computer Science graduate and an iOS Engineer who writes about Swift and iOS development. Follow me on twitter @gurjitpt for more updates.


Next Posts

How to use enum in Swift Empty space for void

Enumerations (enum) enables you to write code in a type safe way. Enum is very useful while defining common type of values. You don't have to provide...

Mar 7, 2023 . 2 min read     Swift Enum

Read More »

Optional unwrapping syntax in Swift 5.7 Empty space for void

Optional unwrapping is one of the most used patterns in iOS development. Swift 5.7 introduces new features included a new way to unwrap optional values...

Jun 14, 2022 . 2 min read     Optional unwrapping

Read More »

Property observers in Swift Empty space for void

It's a common pattern or technique in various programming languages when we want to perform some action when a value is changed. Property ...

May 24, 2021 . 2 min read     Property Observers

Read More »