iOS 11 prefersLargeTitles not updating until scroll

John Breen picture John Breen · Jun 9, 2017 · Viewed 23.8k times · Source

I implemented a basic UIViewController with a UITableView that's wrapped in a UINavigationController. I set prefersLargeTitles to true:

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

    navigationController?.navigationBar.prefersLargeTitles = true
    navigationItem.title = "Coffees"
}

However, the title stays small until I scroll the view, at which point it enlarges. I tried moving that call to where I create the UINavigationController, but there was no effect. I am sure the navigationController is not nil when I set prefersLargeTitles.

Should I be updating that property elsewhere? Or should I file a Radar?

Update:

This only seems to happen if my view contains a UITableView or is itself a UITableViewController

Answer

user1523505 picture user1523505 · Nov 15, 2017

I had the same issue only on one tableview ...

I had to set :

self.tableView.contentInsetAdjustmentBehavior = .never

so that my tableview stop scrolling when uiviewcontroller was loaded.

It's the tableview automatic scrolling that makes the large title being hidden

Hope this helps