Book Image

iOS Development with Xamarin Cookbook

By : Dimitrios Tavlikos (USD)
Book Image

iOS Development with Xamarin Cookbook

By: Dimitrios Tavlikos (USD)

Overview of this book

Table of Contents (22 chapters)
iOS Development with Xamarin Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Navigating through different view controllers


In this recipe, we will learn how to use the UINavigationController class to navigate among multiple view controllers.

Getting ready

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.

How to do it...

Perform the following steps to create navigation among multiple view controllers:

  1. Add three new iPhone view controllers in the project and name them MainController, ViewController1, and ViewController2.

  2. Open the AppDelegate.cs file and add the following code in the FinishedLaunching method:

    MainController mainController = new MainController();
    mainController.Title = "Main View";
    UINavigationController navController = new UINavigationController(mainController);
    window.RootViewController = navController;
  3. Open MainController.xib in Interface Builder and add two buttons with their corresponding...