In this recipe, we will learn how to use the UINavigationController
class to navigate among multiple view controllers.
The UINavigationController
class is a controller that provides hierarchical navigation functionality with multiple view controllers. Create a new iPhone Empty Project in Xamarin Studio and name it NavigationControllerApp
.
Perform the following steps to create navigation among multiple view controllers:
Add three new iPhone view controllers in the project and name them
MainController
,ViewController1
, andViewController2
.Open the
AppDelegate.cs
file and add the following code in theFinishedLaunching
method:MainController mainController = new MainController(); mainController.Title = "Main View"; UINavigationController navController = new UINavigationController(mainController); window.RootViewController = navController;
Open
MainController.xib
in Interface Builder and add two buttons with their corresponding...