如何快速隐藏导航控制器中的后退栏按钮 [英] How hide back bar button in navigation controller with swift
本文介绍了如何快速隐藏导航控制器中的后退栏按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在故事板(Xcode 6、iOS 8 和 swift)中,我在导航控制器中嵌入了一个 TableViewController.
in the Storyboard (Xcode 6, iOS 8 and swift) i have embedded a TableViewController in a Navigation Controller.
从对象库中,我有拖动 &放置一个 Bar Button Item 作为后退按钮,它会显示一个图标图像:当我单击该按钮时,我会显示一个设置视图.
From the object library, i have drag & drop a Bar Button Item as the back button and it show an icon image: when i click that button i show a setting view.
我怎样才能隐藏那个按钮?在 viewDidLoad() 我试过:
How can i hide that button? In the viewDidLoad() i've tried:
self.navigationItem.hidesBackButton = true;
代码已执行(我已尝试使用调试器)但按钮始终可见.
The code is executed (i've tried with the debugger) but the button is always visible.
推荐答案
你必须试试这个:
self.navigationItem.setHidesBackButton(true, animated: false)
希望能帮到你.
这篇关于如何快速隐藏导航控制器中的后退栏按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文