iOS Question How do I dynamically create a date picker?

davepamn

Active Member
Licensed User
Longtime User
I need to dynamically create a date picker for a scrollview and then initialize it with a parameter date.
 

davepamn

Active Member
Licensed User
Longtime User
How do I set the date picker using mm/dd/yyyy?

Do you have a function that converts a date into ticks
 
Upvote 0

davepamn

Active Member
Licensed User
Longtime User
B4X:
    Dim arrDatePicker(100) As DatePicker

    arrDatePicker(iDatePickerCounter).Mode=arrDatePicker(iDatePickerCounter).MODE_DATE
    DateTime.DateFormat = "MM/dd/yyyy"
    arrDatePicker(iDatePickerCounter).Ticks=DateTime.DateParse(sTestIdValue)

This code worked! I was able to set a date and format to Month, Day, and Year in the Picker Control
 
Upvote 0

davepamn

Active Member
Licensed User
Longtime User
this snippet reverses the ticks to a date
B4X:
sTestValue=GetDate(arrDatePicker(i).ticks)

Public Sub GetDate(Ticks As Long) As String

    Dim df As String = DateTime.DateFormat

    DateTime.DateFormat = "MM/dd/yyyy"

    Dim res As String = DateTime.Date(Ticks)

    DateTime.DateFormat = df

    Return res

End Sub
 
Upvote 0

gjoisa

Active Member
Licensed User
Longtime User
In other applications there will be done button to dismiss the picker in Iphone . In Ipad if we touch the out side area of picker it will be dismissed . How the do that ?
 
Upvote 0
Top