Large title issues when using an header view in UITableView

Hi all, I'm struggling with a pretty strange problem and I can't find a solution on how to fix this.

Basically if I add a UIView as header of a UITableView with large titles enabled, the large title starts collapsed and is not large by default. In all others cases, when I push a view controller with a UITableView without the header view, the large title starts large as I wish.

My desired large title behaviour is to see it large also here when I push this view. What I'm doing wrong on? Thank you in advance.

I've attached some screenshots from Storyboard (already from here you can see that the large title gets smaller as soon as I add the view as header) and also a screen from the running app.

Storyboard screens:

First opening on running app (it starts collapsed):

After scrolling it enlarge correctly:

PS: I've also found this question on StackOverflow with the same problem of mine, but with no useful answers. https://stackoverflow.com/questions/59263994/swift-preferslargetitles-not-working-if-there-is-a-headerview-in-tableview

Post not yet marked as solved Up vote post of BiscuitsLover Down vote post of BiscuitsLover
2.2k views

Replies

Same issue here, for my case though, I used

self.navigationItem.setValue(true, forKey: "__largeTitleTwoLineMode")

and this enables the large title to be displayed without truncation but incurs the same issue as yours. For mine however, untruncated titles work fine. I am also very confused.

The solution is to leave a space between the table view and the top view

Add a Comment