【发布时间】:2017-07-25 23:19:00
【问题描述】:
我有两个 viewController。
vc1 -> presentVC -> vc2
vc2继承UINavigationController
我想在vc2中设置title&backButton,但是不行。
class vc2: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
// set title!!!
//self.navigationItem.title = "123"
//self.navigationController?.navigationBar.topItem?.title = "123"
//self.title = "123"
//self.navigationBar.topItem?.title = "123"
//self.navigationItem.title = "123"
// set backButton!!!
let navButtonWidth:CGFloat = 44
let backButton:UIButton = UIButton()
backButton.setImage(backImage, for: .normal)
backButton.addTarget(self, action: #selector(back), for: .touchUpInside)
self.navigationItem.leftBarButtonItems = [UIBarButtonItem(customView: backButton)]
}
【问题讨论】:
-
什么不起作用的按钮没有添加到导航栏或没有执行操作?
-
如何让它工作?
-
你想在按钮点击时继续上一个控制器吗?
标签: ios iphone swift uinavigationcontroller