How do I add a left bar button without overriding the natural back button?

前端 未结 2 986
执笔经年
执笔经年 2021-01-17 22:08

I have a project that uses UIViewControllers embedded in navigation view controllers, so the back button is automatically set up for me whenever I segue into any detail of m

2条回答
  •  余生分开走
    2021-01-17 22:46

    These two lines with do the trick. Set leftItemSupplementBackButton to true, and then add leftBarButtonsItems.

    self.navigationItem.leftItemsSupplementBackButton = true
    self.navigationItem.leftBarButtonItems = [barButton]
    

提交回复
热议问题