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];
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.