I have a view that is UIViewController (root) that handles ads and a UINavigationController. In that UINavigationController I have typical layers of controllers. In my custom settings table view controller, I have a button to contact me for support. When the user clicks this button I create a MFMailComposeViewController and would like to present it. I can’t present it from the settings table view as it will be underneath my ads, so I need to reference the root view and present it from there. I’ve tried self.parentViewController.parentViewController where self is the settings table view, but that doesn’t work. How should I reference this. It seems like a bad design to have to reference the root view directly and pass it to the settings view.
I have a view that is UIViewController (root) that handles ads and a UINavigationController
Share
Get the current keyWindow:
Get its rootViewController:
NOTE: If an
UIAlertViewis currently being shown, a new window is being created and assigned to be the keyWindow. There might be other exceptional cases as well that will not keep your application window to be the keyWindow.