提问人:Burak Akyalçın 提问时间:10/21/2018 最后编辑:Burak Akyalçın 更新时间:10/21/2018 访问量:42
显示操作表时,iPhone 4s 导航栏按钮项会下降
iPhone 4s navigation bar button item goes down when an actionsheet is presented
问:
该应用程序与任何其他设备完美配合,但 iPhone 4s 可以做到这一点。我使用过屏幕调试器,我可以看到它的 y 位置增加,但我不知道为什么。
这是我从 method 调用的代码片段。configureNavigationBarWithTitle()
viewDidLoad()
func configureNavigationBarWithTitle(title: String, shouldDisplayHomeButton: Bool = false) {
self.navigationController?.setNavigationBarHidden(false, animated: true)
self.navigationItem.titleView = UIView.createNavigationTitleView(title: title)
self.navigationItem.leftBarButtonItem = UIBarButtonItem.createAZBackButton(target: self)
self.navigationItem.leftBarButtonItem?.action = #selector(navigateBack(sender:))
if shouldDisplayHomeButton {
self.navigationItem.rightBarButtonItem = UIBarButtonItem.createAZHomeButton(target: self)
self.navigationItem.rightBarButtonItem?.action = #selector(navigateToRoot(sender:))
}
}
extension UIBarButtonItem {
static func createAZBackButton(target: Any?) -> UIBarButtonItem {
let img = UIImage(named: "back")
let button = UIBarButtonItem(image: img, style: .plain, target: target, action: nil)
button.title = ""
button.tintColor = UIColor.white
button.setBackgroundVerticalPositionAdjustment(0, for: .default)
return button
}
static func createAZHomeButton(target: Any?) -> UIBarButtonItem {
let img = UIImage(named: "home")
let button = UIBarButtonItem(image: img, style: .plain, target: target, action: nil)
button.title = ""
button.tintColor = UIColor.white
button.setBackgroundVerticalPositionAdjustment(0, for: .default)
return button
}
答: 暂无答案
评论