UIPickerViewをポップアップして表示する。

UIPickerViewをポップアップして表示しなければならなくなった。
見つけたサンプルを元に少々手を加えて以下のようにした。

UIActionSheet alert = new UIActionSheet("タイトル", null);
alert.Style = UIActionSheetStyle.BlackTranslucent;

UIPickerView picker = new TestPicker(new System.Drawing.RectangleF(0,40,0,0));
picker.ShowSelectionIndicator = true;

alert.AddSubview(picker);

UISegmentedControl closeButton = new UISegmentedControl();
closeButton.InsertSegment("キャンセル", 0, true);
closeButton.Momentary = true;
closeButton.Frame = new System.Drawing.RectangleF(260, 7.0f, 50.0f, 30.0f);
closeButton.ControlStyle = UISegmentedControlStyle.Bar;
closeButton.TintColor = UIColor.Black;
closeButton.ValueChanged += delegate {
	alert.DismissWithClickedButtonIndex(0, true);
	// キャンセルしたときの処理
};
alert.AddSubview(closeButton);

UISegmentedControl okButton = new UISegmentedControl();
okButton.InsertSegment("OK", 0, true);
okButton.Momentary = true;
okButton.Frame = new System.Drawing.RectangleF(10, 7.0f, 50.0f, 30.0f);
okButton.ControlStyle = UISegmentedControlStyle.Bar;
okButton.TintColor = UIColor.Black;
okButton.ValueChanged += delegate {
	alert.DismissWithClickedButtonIndex(0, true);
	// OKしたときの処理
};
alert.AddSubview(okButton);
alert.Bounds = new System.Drawing.RectangleF(0, 0, 320, 485);

alert.ShowInView(window);

これでとりあえずポップアップ表示はできた。