Swift 3 : 我无法隐藏后退按钮

Swift 3 : I can't hide the back button

我正在使用标签栏控制器,上面有 2 个视图控制器。在此之前,我还有另一个 viewController 来访问标签栏。当我得到标签栏时,后退按钮总是消失。我想隐藏后退按钮,用另一个按钮作为左键,但是无法隐藏后退按钮

这是标签栏前 viewController 中的代码:

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if segue.identifier == "mainvc"{
        if pinLabel.text == pinPassword && pinLabel.text != ""{
            let tabBarController = segue.destination as! UITabBarController
            let destinationViewController = tabBarController.viewControllers?[0] as! ViewController

            destinationViewController.login.email = login.email
            destinationViewController.login.firstname = login.firstname
            destinationViewController.login.lastname = login.lastname
            destinationViewController.login.imageURL = login.imageURL
            destinationViewController.login.id = login.id                
        }else{

        }

    }
}

这是我试图隐藏后退按钮并将另一个按钮放入其中一个视图控制器的代码,它是我在访问选项卡栏控制器时看到的视图控制器:

let leftOpenSideBarMenu: UIBarButtonItem = UIBarButtonItem(image: myimage, style: .plain, target: self, action: #selector(ViewController.openSideBarMenu))
self.navigationItem.setHidesBackButton(true, animated: false)
self.navigationItem.setLeftBarButtonItems([leftOpenSideBarMenu], animated: true)

尝试

self.tabBarController.navigationItem.setHidesBackButton(true, animated: false)
self.tabBarController.navigationItem.setLeftBarButtonItems([leftOpenSideBarMenu], animated: true)

而不是

self.navigationItem.setHidesBackButton(true, animated: false)
self.navigationItem.setLeftBarButtonItems([leftOpenSideBarMenu], animated: true)