如何将后退按钮位置更改为嵌入式导航的右侧栏按钮,并将图标从<
更改为>
?
答案 0 :(得分:0)
我的建议是:
隐藏后退按钮:
navigationItem.hidesBackButton = YES
添加带图像箭头的右键:
let backButton = UIBarButtonItem(title: ">", style: .Plain, target: self, action: #selector(backTapped))
navigationItem.rightBarButtonItem = backButton
backTapped的操作将从导航控制器堆栈中弹出视图控制器。
请在评论中告诉我这种方法是否可以解决您的问题。
答案 1 :(得分:0)
我用:
让newView = sabtEnsheabViewController(nibName:&#34; sabtEnsheabViewController&#34;,bundle:nil)
self.navigationController?.pushViewController(newView,animated:false)
但它会显示返回另一个视图的按钮
使用它:
让newView = EnsheabSabteNamViewController(nibName:&#34; EnsheabSabteNamViewController&#34;,bundle:nil)
self.presentViewController(newView,animated:false,completion:nil)
它不再显示navigationBar
答案 2 :(得分:0)
I use this way for change back button position.
//put this code in viewDidLoad()
navigationItem.hidesBackButton = true
navigationItem.rightBarButtonItem = UIBarButtonItem(title: " > ", style: .done,target: self, action: #selector(addTapped))
//function to handle back navigation
@objc func addTapped(){
navigationController?.popToRootViewController(animated: true)
}