In this recipe, we will learn how to use the UIPickerView
class.
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
.
Perform the following steps:
Open the
PickerViewAppViewController.xib
file in Interface Builder. AddUILabel
andUIPickerView
on the main view and save the document.Back in Xamarin Studio, create a nested class in the
PickerViewAppViewController
class that inherits from UIPickerViewModel using the following code:private class PickerModel : UIPickerViewModel
Add the following constructor and fields in the nested class:
public PickerModel (PickerViewAppViewController controller) { this.parentController = controller; this.transportList...