3

I have an issue with UIViewController#presentModalViewController being called twice. I have a modal view, and I trying to bring up another modal view, but the second time nothing happens. I suspect it's hidden?

Anyone else ever do this?

ZaBlanc
  • 4,679
  • 1
  • 35
  • 38

2 Answers2

11

You can't present two modal view controllers on the same parent controller. To show a second one, you should call presentModalViewController on your current modal controller (you may actually have to do it on a new UINavigationController, however, you CAN present a UINavigationController as a modal controller.)

Ben Gottlieb
  • 85,404
  • 22
  • 176
  • 172
0

If you present the same view controller twice, it appears to keep the first instance of the view controller (and the data in the current views), rather than re-load the view.

Note: I'm doing this in Swift 4.0, on Xcode 10. The reason modal is being presented on top of itself, I was testing a modal triggered by a button in a (Today) widget.

benc
  • 1,381
  • 5
  • 31
  • 39