iOS 11 large-title navigation bar not collapsing

后端 未结 7 781
长发绾君心
长发绾君心 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:58

    Good news! I've just figured out that if I set "Large Titles" to "Never" on the storyboard, and then set it via code, then it works:

    - (void)viewDidLoad {
        [super viewDidLoad];
        self.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeAutomatic;
    }
    

    Seems like Apple forgot to handle the case when the navigation item has its largeTitleDisplayMode set via the Interface Builder.

    So until they fix this issue, leave "Large Titles" as "Never" on storyboards, and set them via code in viewDidLoad.

    You just need to do that to the first view controller. Subsequent view controllers honor the value in storyboard.

提交回复
热议问题