0

I was messing up with an app I'm developing and found that when I have three ViewControllers let's say A -> B -> C if I start to slide back from C to B and press the back button while doing so it goes from C to A and sometimes messes up the navigation bar. I've been able to reproduce this issue in Apple's Music App, here's a picture of what it looks like.

Music App example

I've not been able to reproduce in the few non Apple applications I use. For instance in Whatsapp going from Chats to a particular chat and then displaying the contact information does not enable the back button while sliding back.

So, is there a way to disable the navigation bar while I'm sliding back to avoid this? I'm using Swift 3, iOS 10.2 and XCode 8.2.

Thanks.

1 Answers1

0

You can try

//For swift 3
override func viewWillDisappear(_ animated: Bool) {
      super.viewWillDisappear(animated)
      self.navigationController?.navigationBar.isUserInteractionEnabled = false
}
Paddy
  • 766
  • 5
  • 16
Umair Afzal
  • 4,947
  • 5
  • 25
  • 50