この画像のようなピッカーを実装する必要があります。これどうやってするの?私はXamarin.iOSを使用していますが、ネイティブコードの回答を使用して自分で翻訳することができます。Xamarin iOSのポップアップピッカー
1
A
答えて
1
を使用します。
UIToolbar toolBar = new UIToolbar(new CGRect(0, 0, 320, 44));
UIBarButtonItem flexibleSpaceLeft = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace,null,null);
UIBarButtonItem doneButton = new UIBarButtonItem("OK",UIBarButtonItemStyle.Done,this, new ObjCRuntime.Selector("DoneAction"));
UIBarButtonItem[] list = new UIBarButtonItem[] { flexibleSpaceLeft, doneButton };
toolBar.SetItems(list, false);
UIPickerView pickerView = new UIPickerView(new CGRect(0, 44, 320, 216));
pickerView.DataSource = new MyUIPickerViewDataSource();
pickerView.Delegate = new MyUIPickerViewDelegate();
pickerView.ShowSelectionIndicator = true;
textField.InputAccessoryView = toolBar;
textField.InputView = pickerView;
あなたのDataSource
を実装した後、ピッカービューのDelegate
、それはl IKEこの:写真のように
2
あなたは、TextFieldのInputView
プロパティにPickerViewを割り当てて、このように、InputAccessoryView
にツールバーを割り当てることができますActionSheet
actionSheetButton.TouchUpInside += ((sender, e) => {
// Create a new Alert Controller
UIAlertController actionSheetAlert = UIAlertController.Create("Action Sheet", "Select an item from below", UIAlertControllerStyle.ActionSheet);
// Add Actions
actionSheetAlert.AddAction(UIAlertAction.Create("Item One",UIAlertActionStyle.Default, (action) => Console.WriteLine ("Item One pressed.")));
actionSheetAlert.AddAction(UIAlertAction.Create("Item Two",UIAlertActionStyle.Default, (action) => Console.WriteLine ("Item Two pressed.")));
actionSheetAlert.AddAction(UIAlertAction.Create("Item Three",UIAlertActionStyle.Default, (action) => Console.WriteLine ("Item Three pressed.")));
actionSheetAlert.AddAction(UIAlertAction.Create("Cancel",UIAlertActionStyle.Cancel, (action) => Console.WriteLine ("Cancel button pressed.")));
// Required for iPad - You must specify a source for the Action Sheet since it is
// displayed as a popover
UIPopoverPresentationController presentationPopover = actionSheetAlert.PopoverPresentationController;
if (presentationPopover!=null) {
presentationPopover.SourceView = this.View;
presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
}
// Display the alert
this.PresentViewController(actionSheetAlert,true,null);
});
関連する問題
- 1. XamarinのiOS:アプリxamarin私のIOSでJavaScript
- 2. Xamarin iOSのTypedValue
- 3. xamarinのIOSコレクションビュー
- 4. Xamarin IOSのグローバルスタイル
- 5. Xamarin IOSアプリのクラッシュログ
- 6. Xamarin IOSボタンのID
- 7. Xamarinリストビューは、iOSの
- 8. Xamarin ios Appのヌルリファレンス
- 9. Xamarin iOSスライダの色
- 10. アクションシートのテーブルビューxamarin ios
- 11. Xamarin iOSでのロギングフレーム
- 12. Xamarin IOSのビルドエラー2017
- 13. xamarin iosプロジェクトのプロパティ
- 14. XamarinのiOSは、テストレコーダー
- 15. XamarinとIOS開発への新たなXamarin IOSのFacebook SDK LoginButton
- 16. Xamarin iOS - PrepareForSegueコンパイルエラー
- 17. XamarinフォームマップタップジェスチャーIOS
- 18. Xamarin iOSシミュレータビルド
- 19. Xamarin IOS SQLite
- 20. Xamarin IOS setDesiredConnectionLatency
- 21. Xamarin iOSプロジェクト&ビルドサーバ
- 22. マルチカラムテーブルios Xamarin c#
- 23. Xamarin iOS c__AnonStorey1
- 24. Xamarin iOS - Interactive Swipe
- 25. Xamarin iOSデバッグ
- 26. Xamarin iOSメモリプロファイリング
- 27. Xamarin iOS HockeyAppベストプラクティスセットアップ?
- 28. Deep-linking Xamarin iOS
- 29. Xamarin IOSでのVisual Studioを使用してXamarin IOS Stackview
- 30. realm iOSとrealmの互換性Xamarin iOS && realm Javaとrealm Xamarin Android
ではなく、同じ「スピナー」コントロール。私はそれがネイティブコントロールだと確信していますか? – Darius