When using prefersLargeTitles for a UINavigationController
's UINavigationBar
in iOS 11
, the nav bar increases height. The increase is from 44 to 96 on the iPhones I have checked, but I think those numbers can change per device (or at least we need to code as if they can).
I want to programmatically find the 'extra' height - the height of the large titles area that is added beneath the traditional UINavigationBar
when a large title is displayed. I can easily find the entire height of the bar with the large title displayed, but is there a way to programmatically find the height of the large title portion of the bar alone (without any hardcoding)?
The reason I need this is that there are times that I want to programmatically scroll to the top of a UITableView, pulling down the large title (which has scrolled up under the "regular height" nav bar) so that it is showing, and the content offset I need is the extra height of the nav bar. I could use the total height of the navigation bar, but this would pull the UITableView down too far. To do this now, I need to hardcode as below:
[self.tableView setContentOffset:CGPointMake(0, -52) animated:NO];
scrollToRowAtIndexPath:atScrollPosition:animated:
), that should be enough. – Session