I have seen similar questions, but those questions are all very old. I'm trying to hide the 'back' button in my ViewController. Now, it looks like this: https://www.dropbox.com/s/ipmbqgxji574j06/Screenshot%202020-07-21%2020.25.17.png?dl=0
My code (I've tried implementing it in both viewWillAppear & viewDidLoad, neither seem to work):
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Setting up title of ViewController
self.navigationController?.isNavigationBarHidden = false
self.navigationController?.navigationBar.topItem?.title = "Groceries"
self.navigationController?.navigationBar.prefersLargeTitles = true
self.navigationItem.hidesBackButton = true
}
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.setHidesBackButton(true, animated: true)
print(self.navigationItem.hidesBackButton)
// Returns true
}
I have also tried putting the code in prepareForSegue:
override func prepare(for segue: UIStoryboardSegue, sender: Any?){
if segue.identifier == K.welcomeSegue{
let objVC = segue.destination as? TableViewController
objVC?.navigationItem.hidesBackButton = true
}
}
Could anyone help me?
Thanks!