【发布时间】:2018-07-18 15:08:39
【问题描述】:
我正在使用 pushViewController,如下代码:
let vc = A()
self.navigationController?.pushViewController(vc, animated:true)
我想向打开的页面添加一个导航项。此代码适用于新版本,但在 iPhone 5(iOS 9.3) 模拟器 和 iPad(10.3.3) 上不起作用 )
class A: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
configureNavigationItem()
}
func configureNavigationItem() {
let buttonLogo = UIButton(type: .custom)
buttonLogo.setImage(UIImage(named: "logo"), for: .normal)
buttonLogo.setTitle("", for: .normal)
buttonLogo.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: -9, right: 0)
let itemLogo = UIBarButtonItem(customView: buttonLogo)
self.navigationItem.setLeftBarButton(itemLogo, animated: true)
}
}
旧版本中没有任何内容。我该如何解决这个问题?
【问题讨论】:
标签: ios swift uinavigationitem