【发布时间】:2017-04-25 08:54:37
【问题描述】:
请看我的截图,iphone plus 上总是显示蓝色的“Back”文字(6s plus,7 plus 模拟器和真机)。它不会在小屏幕 iphone 上显示。我尝试了很多方法来隐藏/从当前/上一个控制器更改它,但没有运气。
那么为什么它可以在较小的 iphone 上运行,而不是在 plus 上呢?
谁能帮帮我:(。谢谢。
代码如下:
@IBAction func filter(_ sender: Any) {
let view:FilterViewController = self.storyboard?.instantiateViewController(withIdentifier: "FilterViewController") as! FilterViewController
view.superVC = self
view.currentFilter = currentFilter
self.setLeftCloseNavigation()
self.navigationController?.pushViewController(view, animated: true)
}
func setLeftCloseNavigation(){
self.navigationController?.navigationBar.backgroundColor = UIColor.clear
self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController?.navigationBar.layer.mask = nil
self.navigationController?.navigationBar.backIndicatorImage = UIImage(named: "icon_close")?.withRenderingMode(.alwaysOriginal)
self.navigationController?.navigationBar.backIndicatorTransitionMaskImage = UIImage(named: "icon_close")?.withRenderingMode(.alwaysOriginal)
navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
}
这是推送控制器中的 viewDidLoad:
override func viewDidLoad() {
super.viewDidLoad()
statusBar = UIColor.black
setResetNavigation() }
func setResetNavigation(){
navigationItem.hidesBackButton = false
let skipButton = UIButton(frame: CGRect(x: 0, y: 0, width: 70, height: 30))
skipButton.setTitle("Reset all".localized(), for: .normal)
skipButton.setTitleColor(UIColor.black, for: .normal)
skipButton.titleLabel?.font = UIFont(name: "HJGothamMedium", size: 16)
skipButton.addTarget(self, action: #selector(resetAllClicked), for: .touchUpInside)
let skip = UIBarButtonItem(customView: skipButton)
navigationItem.rightBarButtonItem = skip
}
这是视图层次结构
【问题讨论】:
-
你能显示一些代码吗
-
在情节提要中检查您的视图并删除该按钮。
-
这是 presentViewController 吗?
-
没有@KKRocks,这是推送后的视图控制器
-
@Bhupat 我添加了一些代码
标签: ios iphone swift button navigationbar