Amir_P Amir_P - 4 months ago 7
Swift Question

Can't hide BackButton after performSegueWithIdentifier

In my application I have a login scene which embedded with

Navigation Bar
. after user logged in, I'm navigating to home scene which only embedded with
Tab Bar
. For navigating I'm using a Segue and this is my code:

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


and in next scene
viewDidLoad
I'm trying to
hideBackButton
but it doesn't work

I tried all of this codes but BackButton still showing so this is not duplicated question:

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

Answer

Write this in your viewDidLoad method. It should work:

self.tabBarController?.navigationItem.hidesBackButton = true
Comments