I need to check if there is still a modal view over the root view controller. The problem I am facing is that I have a second modal view coming from some thread that needs to be displayed. I want to delay the second modal view until the first one is gone. I cannot just launch it after the first is dismissed because the second modal view is conditional.
[self.window.rootViewController presentModalViewController:vc animated:YES];
What I want to do (feel free to suggest a better alternative way):
self.window.rootViewController
currently has a modal view displayed on top (or is still animating modal view).performSelector:afterDelay:0.1
Get rootViewController.presentedViewController
(available in iOS 5.0+) or rootViewController.modalViewController
(available in iOS 2.0+) and see if it's nil.
Also, you don't want to present the second view controller from the secondary thread, all UI stuff has to be done on the main thread.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With