1

I have a uisearch bar with code to search some data. After I click on some of that, I need to push to another UIView.

So I am using this

let vc=self.storyboard?.instantiateViewController(withIdentifier: "id") as! mapViewController
self.present(vc, animated: true, completion: nil)

It works well, but after segue, the view is not in the narvigation controller, because it is a present. So I wish to use show segue. Then I change the code to

    self.show(vc, sender: self)

When I run it, it does not work and shows

"while an existing transition or presentation is occurring; the navigation stack will not be updated."

What should I do to use show segue here?

Xie
  • 627
  • 1
  • 8
  • 18

3 Answers3

0

Use the pushViewController method

self.navigationController?.pushViewController(vc, animated: true)
Efi Weiss
  • 638
  • 6
  • 12
0

As the message implies (well, it shouts that right in your face). You should not start the (animated) segue of yours until the last animated nav action will have finished. The code (of yours) needs restructuring to allow for that to happen.

Anton Tropashko
  • 5,486
  • 5
  • 41
  • 66
0

Your current ViewController also need to be in navigation Stack after that you can push another controller . First set current ViewController as rootViewController of an Navigation Controller and then push your mapViewController from your current Controller.

Sumit Jangra
  • 651
  • 5
  • 16