Wheel Picker Dialog - StansAssets/com.stansassets.ultimate-mobile GitHub Wiki
The UM_WheelPickerDialog
is a simple dialog containing native NumberPicker
for Android and UIPickerView
for iOS. This component allows your app user to pick any data from wheel picker that you want.
using SA.CrossPlatform.UI;
First al all you need to set data for our picker and then create a new instance of it:
var values = new List{"Test 1", "Test 2", "Test 3"};
var picker = new UM_WheelPickerDialog(values);
You can also define the default value if you need it. For example, if you want "Test 3" preselected as the default value:
var picker = new UM_WheelPickerDialog(values, 2);
Then just call Show()
to show your picker:
picker.Show(result =>
{
if (result.HasError)
{
UM_DialogsUtility.DisplayResultMessage(result);
}
else
{
switch (result.State)
{
case UM_WheelPickerState.InProgress:
Debug.Log($"User in progress, current picked value: {result.Value}");
break;
case UM_WheelPickerState.Done:
UM_DialogsUtility.ShowNotification($"User picked item: {result.Value}");
break;
case UM_WheelPickerState.Canceled:
UM_DialogsUtility.ShowNotification($"User canceled picker dialog.");
break;
default:
throw new ArgumentOutOfRangeException();
}
}
});
Also, you can look on native wheel pickers here for iOS and for Android.