【发布时间】:2017-05-12 06:57:31
【问题描述】:
我有问题。
我使用show(vc) 来展示一个视图控制器。
vc1 --> vc2 --> vc3
当用户单击 vc3 上的后退按钮时,我想将用户从 vc1 重定向,以实现我使用下面提到的代码。
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.hidesBackButton = true
let newBackButton = UIBarButtonItem(title: "<", style: UIBarButtonItemStyle.plain, target: self, action: #selector(backToRoot(sender:)))
self.navigationItem.leftBarButtonItem = newBackButton
}
func backToRoot(sender: UIBarButtonItem) {
_ = self.navigationController?.popToRootViewController(animated: true)
}
我想要返回按钮的默认图像,而不是自定义按钮。
有什么办法可以做到吗?
【问题讨论】:
-
感谢 Parth Bhatt 编辑。
标签: ios swift cocoa-touch uinavigationcontroller