【问题标题】:Can't hide BackButton after performSegueWithIdentifier [duplicate]performSegueWithIdentifier 后无法隐藏 BackButton [重复]
【发布时间】:2016-08-02 09:10:06
【问题描述】:

在我的应用程序中,我有一个嵌入了Navigation Bar 的登录场景。用户登录后,我将导航到仅嵌入Tab Bar 的家庭场景。对于导航,我使用的是 Segue,这是我的代码:

self.performSegueWithIdentifier("loginSegue", sender: nil)

在下一个场景中 viewDidLoad 我正在尝试 hideBackButton 但它不起作用

我尝试了所有这些代码,但 BackButton 仍然显示 所以这不是重复的问题

    self.navigationItem.leftBarButtonItem = nil
    self.navigationController?.navigationItem.leftBarButtonItem=nil
    self.navigationItem.hidesBackButton=true
    self.navigationController?.navigationItem.hidesBackButton=true
    self.navigationItem.setHidesBackButton(true, animated:true);

【问题讨论】:

    标签: swift layout segue


    【解决方案1】:

    把它写在你的 viewDidLoad 方法中。它应该工作:

    self.tabBarController?.navigationItem.hidesBackButton = true
    

    【讨论】:

    • 我已经这样做了,但没有工作
    • 我已经更新了我的答案。现在它应该可以工作了!
    • 谢谢,但为什么 self.navigationItem.hidesBackButton = true 不起作用?还是其他的?
    【解决方案2】:

    放这行代码

    self.navigationItem.leftBarButtonItem = nil
    

    在您的 viewDidLoad 方法中。希望这会对你有所帮助。

    【讨论】:

    • 那行不通
    猜你喜欢
    • 1970-01-01
    • 2016-12-17
    • 1970-01-01
    • 2013-09-30
    • 2015-09-24
    • 1970-01-01
    • 1970-01-01
    • 2015-09-16
    相关资源
    最近更新 更多