Hide back button in navigation bar with hidesBackButton in Swift

前端 未结 9 1964
没有蜡笔的小新
没有蜡笔的小新 2021-01-31 08:36

I want to hide the back button when transitioning from one view to another. I read the questions regarding this problem and every answer was \"use hidesBackButton\"

相关标签:
9条回答
  • 2021-01-31 09:09

    Try adding this,This worked for me

    navigationItem.hidesBackButton = true
    
    0 讨论(0)
  • 2021-01-31 09:12

    This worked for me:

    override func viewWillAppear(animated: Bool)
    {
        super.viewWillAppear(animated)
    
        self.tabBarController?.navigationItem.hidesBackButton = true
    }
    
    0 讨论(0)
  • 2021-01-31 09:14

    Worked for me when I set it in init(), instead of viewDidLoad. Strange though

    0 讨论(0)
提交回复
热议问题