How do I programmatically switch the view controller in iOS?
So example - I have a menu MVC setup, now I click "Help" How do I programmatically hand this off to the help view controller to load that MVC setup?
Is this a View-based or Navigation-based application?
For a Navigation-based application, your AppDelegate should provide you access to a shared UINavigationController which you can use to push/pop UIViewControllers
[self.navController pushViewController:helpViewController animated:YES]
then when the user wants to leave the Help view and go back to the main screen, you would pop it off. This functionality is provided automatically by the left/back button in the UINavigationBar, but you can trigger it manually using the popViewcontrollerAnimated selector:
[self.navController popViewControllerAnimated:YES]
For View-based applications, you move between screens by manipulating the subviews
[window addSubview:helpViewController.view]
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