Class

iOSDatePicker


Warning

This item was deprecated in version 2020r2. Please use MobileDateTimePicker as a replacement.

Description

This is the standard Button control for iOS.

Events

Name

Parameters

Returns

Close

Open

ValueChanged

Enumerations

iOSDatePicker.Modes

Modes

Time, Date, DateAndTime, CountDownTimer

Enum

Time

Date

DateAndTime

CountDownTimer

Property descriptions


iOSDatePicker.AccessibilityHint

AccessibilityHint As Text

The accessibility hint is a longer description that is read aloud when VoiceOver is enabled.

Me.AccessibilityHint = "Click to calculate the value and display the next view."

iOSDatePicker.AccessibilityLabel

AccessibilityLabel As Text

The accessibility label of of a control is a short name that is read aloud when VoiceOver is enabled.

Me.AccessibilityLabel = "Calculate the value."

iOSDatePicker.CountDownDuration

CountDownDuration As Double

The countdown duration (in seconds) to display when DatePickerMode = CountDownTimer. Contains the selected value.

Set a date picker (in CountDownTimer mode) to 5 minutes:

CountDownPicker.CountDownDuration = 60 * 5

iOSDatePicker.DefaultDate

DefaultDate As Xojo.Core.Date

The default date to display when DatePickerMode = Date or DateAndTime. Contains the selected date. By default, the current date and/or time is displayed (for date and time display modes).

Gets the selected date from the date picker:

Var selectedDate As Xojo.Core.Date
selectedDate = StartDatePicker.DefaultDate

iOSDatePicker.Enabled

Enabled As Boolean

Indicates if the DatePicker is enabled or disabled.

Disable a date picker:

StartDatePicker.Enabled = False

iOSDatePicker.Height

Height As Double

The height of the control.

This property is read-only.


iOSDatePicker.Left

Left As Double

The left position of the control.

This property is read-only.


iOSDatePicker.MaximumDate

MaximumDate As Xojo.Core.Date

The maximum date in the scrolling list. Applicable when Mode is Modes.Date or Modes.DateAndTime.

Dates after the maximum date still appear in the scrolling list, but cannot be selected.

Limit the maximum date to 50 years in the future:

Var futureDate As Xojo.Core.Date
Var interval As New Xojo.Core.DateInterval
interval.Years = 50
futureDate = Xojo.Core.Date.Now + interval
StartDatePicker.MaximumDate = futureDate

iOSDatePicker.MinimumDate

MinimumDate As Xojo.Core.Date

The minimum date in the scrolling list. Applicable when Mode is Modes.Date or Modes.DateAndTime.

Dates before the minimum date still appear in the scrolling list, but cannot be selected.

Limit the minimum date to 100 years in the past:

Var pastDate As Xojo.Core.Date
Var interval As New Xojo.Core.DateInterval
interval.Years = -100
pastDate = Xojo.Core.Date.Now + interval
StartDatePicker.MinimumDate = pastDate

iOSDatePicker.MinuteInterval

MinuteInterval As Integer

The minute interval. The default is 1. This is only applicable when Mode is Modes.Time, Modes.DateTime and Modes.CountDownTimer.

The value must be an even divisor of 60: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30. Invalid values are treated as 1.

Change the minute interval to 15 minutes:

CountdownPicker.MinuteInterval = 15

iOSDatePicker.Mode

Mode As Modes

Uses Modes to specify how the DatePicker should appear. Changing between date/time modes and CountdownTimer resets property values to their defaults.

Change the date picker to show dates:

StartDatePicker.Mode = iOSDatePicker.Modes.Date

iOSDatePicker.Name

Name As Text

The name of the control. This can only be set in the Inspector. Use the name to refer to the control.

This property is read-only.


iOSDatePicker.Parent

Parent As iOSControl

Indicates the control's parent object, if it has one. If there is no parent, this is Nil.

This property is read-only.


iOSDatePicker.Top

Top As Double

The top position of the control.

This property is read-only.


iOSDatePicker.Visible

Visible As Boolean

Indicates whether the control is visible.

Make a button invisible:

Button1.Visible = False

iOSDatePicker.Width

Width As Double

The width of the control.

This property is read-only.

Method descriptions


iOSDatePicker.AddConstraint

AddConstraint(constraint As iOSLayoutConstraint)

Adds a constraint to the control. This constraint is used by child controls that have been added to this control.


iOSDatePicker.AddControl

AddControl(child As MobileControl)

Adds a child control to the control.


iOSDatePicker.Control

Control(index As Integer) As MobileControl

Gets the child control at the specified index.


iOSDatePicker.ControlCount

ControlCount As Integer

The number of child controls in the control.


iOSDatePicker.DefaultDate

DefaultDate(animate As Boolean, Assigns value As DateTime)

Used to set the default date, showing a scrolling animation to the specified date.


iOSDatePicker.Handle

Handle As Ptr

The handle is used to get a reference to the control for interfacing directly with the iOS API.


iOSDatePicker.Invalidate

Invalidate

Marks the control so that it will be redrawn during the next event loop.

Call Invalidate to force a Canvas to redraw itself:

Canvas1.Invalidate

iOSDatePicker.RemoveConstraint

RemoveConstraint(constraint As iOSLayoutConstraint)

Removes a constraint from the control.


iOSDatePicker.RemoveControl

RemoveControl(child As MobileControl)

Removes the control from the control.


iOSDatePicker.SetTintColor

SetTintColor(value As Color)

Changes a control's tint color. This varies by control and for some controls may not do anything. For example, with an MobileTextField this changes the cursor color.

Event descriptions


iOSDatePicker.Close

Close

Called when the control is removed from its container, such as a view.


iOSDatePicker.Open

Open

Called after the control is created. This is where you typically put initialization code.

Set label text in Open event:

Me.Text = "Hello"

iOSDatePicker.ValueChanged

ValueChanged

Called when the selection in the DatePicker is changed. Use the DefaultDate property to get the newly selected date value.

Compatibility

iOS projects on the iOS operating system.

See also

MobileControl parent class; DateTime class