iOS 11 large-title navigation bar not collapsing

后端 未结 7 780
长发绾君心
长发绾君心 2020-12-02 18:31

The Apple guy in the What\'s new in Cocoa Touch WWDC video said that the new large-title navigation bar will magically hook into the top-level scroll view of the underlying

7条回答
  •  南笙
    南笙 (楼主)
    2020-12-02 18:51

    Since I can't comment I'll share here the answer I posted

    https://stackoverflow.com/a/47493375/8385022

    I found a workaround on this site basically, if the tableView (or element that has scroll)is not the first view in your view hierarchy, the large title fails to hide automatically.

    Example that will NOT work Example that will work

    https://markusbodner.com/2017/10/08/fix-large-navigation-bar-title-not-hiding-on-scroll-in-ios-11/

    I added on the view willAppear:

            if #available(iOS 11.0, *) {
            navigationController?.navigationBar.prefersLargeTitles = true
        } else {
            // Fallback on earlier versions
        }
    

提交回复
热议问题