谁能描述我如何使用 XCode 在 monotouch 中创建 UIPickerView 并用示例数据填充它?
我确实在这里查看了示例:https ://github.com/xamarin/monotouch-samples/blob/master/MonoCatalog-MonoDevelop/PickerViewController.xib.cs但这并不是很有帮助,因为我正在创建我的 UIPickerView X代码。这是我到目前为止所拥有的:
public partial class StatusPickerPopoverView : UIViewController
{
public StatusPickerPopoverView (IntPtr handle) : base (handle)
{
pickerStatus = new UIPickerView();
pickerStatus.Model = new StatusPickerViewModel();
}
public StatusPickerPopoverView (): base ()
{
}
public class StatusPickerViewModel : UIPickerViewModel
{
public override int GetComponentCount (UIPickerView picker)
{
return 1;
}
public override int GetRowsInComponent (UIPickerView picker, int component)
{
return 5;
}
public override string GetTitle (UIPickerView picker, int row, int component)
{
return "Component " + row.ToString();
}
}
}