iOS Question Old Style DatePicker?

ilan

Expert
Licensed User
Longtime User
What happened to the old DatePicker. I wanted to update my app and I have a completely different date/time picker that will need me to update my whole UI and that's a lot of work.
the truth is that I even don't like the new picker very much, how can I get the old picker back?
 

Semen Matusovskiy

Well-Known Member
Licensed User
Try
B4X:
If App.OSVersion >= 13.4 Then
        Dim no As NativeObject = DatePicker1
        no.SetField ("preferredDatePickerStyle", 1)
End If

Possible values
UIDatePickerStyleAutomatic = 0
A style indicating that the system picks the concrete style based on the current platform and date picker mode.

UIDatePickerStyleCompact = 2
A style indicating that the date picker displays as a label that when tapped displays a calendar-style editor.

UIDatePickerStyleInline = 3
A style indicating that the date pickers displays as an inline, editable field.

UIDatePickerStyleWheels = 1
A style indicating that the date picker displays as a wheel picker.
 
Last edited:
Upvote 0

ilan

Expert
Licensed User
Longtime User
do i need the If ... App.OSVersion Condition?
can i just set all pickers to "preferredDatePickerStyle = 1" even for older ios devices or will i get a crash?
 
Upvote 0

b4x-de

Active Member
Licensed User
Longtime User
Hi,

in my code it does not have any effect on the datepicker style. I tried to change the style after loading the layout from a layout file like this:

B4X:
Sub Process_Globals
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page
    Private DatePicker1 As DatePicker
End Sub

Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.RootPanel.LoadLayout("Page1")
    NavControl.ShowPage(Page1)
    
    If App.OSVersion >= 13.4 Then
        Dim no As NativeObject = DatePicker1
        no.SetField ("preferredDatePickerStyle", 2)
    End If
End Sub

Private Sub Page1_Resize(Width As Int, Height As Int)
    
End Sub

Am I doing something wrong?

Thanks,
Thomas
 
Upvote 0
Top