在 viewWillAppear
中,我隐藏了我的 navigationController
和 navigationBar
,如下所示:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.setNavigationBarHidden(true, animated: true)
self.navigationController?.interactivePopGestureRecognizer?.delegate = nil
}
然后我在我的 Storyboard
中添加了一个 navigationBar
并将它连接到我的 UIViewController
中的一个 IBOutlet
以自定义它来自IB。
一切正常,除了我无法将默认的 backButton
从原来隐藏的 navigatioBar
移动到我新的自定义 navigationBar
。
问题:
有没有办法将 backButton
从默认的 navigationBar
移动到这个新的自定义 navigationBar
?**
注意:我不想添加自定义后退按钮。
最佳答案
你不能。您需要创建自己的 UIBarButtonItem
let backItem = UIBarButtonItem(title: "Back", style: .plain, target: self, action: #selector(yourSelector))
self.navigationItem.leftBarButtonItem = backItem
关于ios - 快速将 backButton 从默认 UINavigationbar 移动到 customNavigationbar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43174721/