Calling presentModalViewController twice?
I have an issu开发者_高级运维e 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?
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.)
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.
精彩评论