iOS 11 prefersLargeTitles not updating until scroll

前端 未结 24 2345
轻奢々
轻奢々 2021-01-31 07:25

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

override fu         


        
24条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-31 08:19

    I have wasted some considerable amount of time on this as prefersLargeTitle saga works on some view controllers as expected and with some it produces the same issue above.

    Solution for me was to uncheck Extended Edges Under Top Bars in IB - for those view controllers who show large title momentarily until the contents of the table view are loaded then navigation bar jumps back up to regular size. It only shows the large title when scrolling the table view down.

    This is backward compatible with iOS 10 and does not leave any empty space above the first row in the table view.

    I had checked prefersLargeTitle on the navigation controllers attributes inspector only in IB - nothing in code. Same for largeTitleDisplayMode = .always

    As for why this happens with some view controllers and not others, I have absolutely no idea!

提交回复
热议问题