# P. 348/Chap 16 -- Fix the Titles

**URL:** <https://forums.kodeco.com/t/p-348-chap-16-fix-the-titles/38121>\
**Category:** iOS Apprentice\
**Created:** [December 31, 2017, 7:31pm UTC](https://forums.kodeco.com/t/p-348-chap-16-fix-the-titles/38121 "2017-12-31T19:31:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![7stud](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/7stud/32/81494_2.png) [@7stud](https://forums.kodeco.com/u/7stud)\
**Post date:** [December 31, 2017, 7:31pm UTC](https://forums.kodeco.com/t/p-348-chap-16-fix-the-titles/38121/1 "2017-12-31T19:31:13Z")

</div>

Can you explain how setting:

`navigationItem.largeTitleDisplayMode = .never`

in the ChecklistViewController affects what is displayed for the AllLIstsViewController? My solution had the following line instead:

`navigationController?.navigationBar.prefersLargeTitles = false`

and with my code if I tap on a checklist in the AllListsViewController, which takes me to the ChecklistViewController, and then I tap on the back button, which takes me back to the AllListsViewController, the title at the top of the table will change to small type–even though the AllListsViewController sets the navigation bar to prefer large titles. With the .never line instead of my code, the title for the AllListsViewController table is displayed in large type after I hit the back button.

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [December 31, 2017, 8:11pm UTC](https://forums.kodeco.com/t/p-348-chap-16-fix-the-titles/38121/2 "2017-12-31T20:11:31Z")

</div>

@hollance @fahim Do you have any feedback regarding this? Thank you - much appreciated! :]

---

<div class="post-metadata">

**Author:** ![fahim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/fahim/32/110943_2.png) [@fahim](https://forums.kodeco.com/u/fahim)\
**Post date:** [January 1, 2018, 12:31am UTC](https://forums.kodeco.com/t/p-348-chap-16-fix-the-titles/38121/3 "2018-01-01T00:31:33Z")

</div>

> [@7stud](#):
>
> Can you explain how setting:
> 
> navigationItem.largeTitleDisplayMode = .never
> 
> in the ChecklistViewController affects what is displayed for the AllLIstsViewController?

Setting `largeTitleDisplayMode` to `.never` in `ChecklistViewController` should not affect anything in `AllLIstsViewController` if that was your main question. I wasn’t quite clear if that was the question or if you were wondering about how navigating back from `ChecklistViewController` affected the titles in `AllLIstsViewController` after your custom changes since that’s a separate issue …

To take this as two separate items, let’s take setting `navigationItem.largeTitleDisplayMode = .never` in `ChecklistViewController` first. This simply forces the navigation bar to display small titles for the `ChecklistViewController` explicitly. How titles are displayed in other view controllers (such as `AllLIstsViewController`) would depend on how those particular view controllers are set up). This is why we set the overall navigation bar for the app to display large titles by default with the `navigationController?.navigationBar.prefersLargeTitles = true` line which is moved to `AllLIstsViewController`, which is the initial view controller at this point.

So, with that set up, when you first start the app, the initial view controller would show large titles since it would have the following settings:  
`navigationController?.navigationBar.prefersLargeTitles = true`

Your `ChecklistViewController` is explicitly turning off these large titles for its navigation item only by using the following line in its `viewDidLoad`:  
`navigationItem.largeTitleDisplayMode = .never`

But when you go back to the previous view, the default setting for the navigation bar as a whole (not the navigation item) kicks in and you get large titles.

When you use `navigationController?.navigationBar.prefersLargeTitles = false` in `ChecklistViewController`, that changes the settings for the navigation bar as a whole, not your current navigation item. So, now your navigation bar is set to not show large titles. So, when you go back to `AllLIstsViewController`, that will show small titles too since `viewDidLoad` is executed only once and the setting of large titles in `AllLIstsViewController` happened the first time that view is loaded - it is not reloaded when you go back from `ChecklistViewController` since there in an instance of `AllLIstsViewController` in the navigation stack. So you simply have the navigation bar now at the following state when you go back to `AllLIstsViewController`:  
`navigationController?.navigationBar.prefersLargeTitles = false`

So, you get small titles this time around for `AllLIstsViewController`.

Hope that makes sense?

---

<div class="post-metadata">

**Author:** ![7stud](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/7stud/32/81494_2.png) [@7stud](https://forums.kodeco.com/u/7stud)\
**Post date:** [January 1, 2018, 6:30am UTC](https://forums.kodeco.com/t/p-348-chap-16-fix-the-titles/38121/4 "2018-01-01T06:30:46Z")

</div>

> if you were wondering about how navigating back from ChecklistViewController affected the titles in AllLIstsViewController after your custom changes

That’s it. Thanks for the explanation fahim. ☀

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [June 16, 2018, 11:31am UTC](https://forums.kodeco.com/t/p-348-chap-16-fix-the-titles/38121/5 "2018-06-16T11:31:14Z")

</div>

Closed on June 16, 2018, 11:31am UTC

This topic was automatically closed after 166 days. New replies are no longer allowed.
