I have a UIAlertView . When the user clicks a button in the alert view, I want to show the new UIViewController .
To achieve this, I need to know which view controller is currently displayed on the screen, because this particular view controller is the right one to present the new view controller.
The problem is that I have a complex hierarchy of concepts controllers in my application, including UINavigationController and a UITabBarController (among others). So I canβt just use self.visibleViewController to get the currently visible view controller.
I have found https://stackoverflow.com/a/166269/167161/ but I would like to find a more accurate solution without having to scan the entire view controller stack.
source share