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

Providing lists


In this recipe, we will learn how to use the UIPickerView class.

Getting ready

The UIPickerView class provides us with a control whose functionality is similar to that of a list box. It is specifically designed for human fingers that touch the screen. Its main difference from a common list box is that each column can have its own number of rows. To get started, create a new iPhone Single View Application project and name it PickerViewApp.

How to do it...

Perform the following steps:

  1. Open the PickerViewAppViewController.xib file in Interface Builder. Add UILabel and UIPickerView on the main view and save the document.

  2. Back in Xamarin Studio, create a nested class in the PickerViewAppViewController class that inherits from UIPickerViewModel using the following code:

    private class PickerModel : UIPickerViewModel
  3. Add the following constructor and fields in the nested class:

    public PickerModel (PickerViewAppViewController controller) {
      this.parentController = controller;
      this.transportList...