# Titanium.UI.Picker

> A control used to select one or more fixed values.

- Source: https://titaniumsdk.com/docs/sdk/12.6.2/Titanium.UI.Picker
- Titanium SDK version: 12.6.2
- Kind: view
- Platforms: Android, iPhone, iPad, macOS
- Since: Titanium SDK 0.8
- Extends: Titanium.UI.View
- Inheritance: Titanium.UI.View > Titanium.Proxy

| Android | iOS |
| ------- | --- |
| ![Android](./picker_android.png) | ![iOS](./picker_ios.png) |

Use the [Titanium.UI.createPicker](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#createPicker) method or Alloy **`<Picker>`** element to create a picker control.

On Android, the `useSpinner` property must be enabled to support multiple columns.
By default, the spinner is automatically sized to fit its content and can overflow
to additional spinner rows. The size of the picker can be adjusted with the `width`
and `height` properties, but may omit picker columns or cut off picker rows
if the size is set too small. This property is deprecated. Please use the default
Android native "dropdown" style by not setting `useSpinner` to `true`.

On iOS, the `height` property is only available in iOS 9 and later.
By default, the size of the picker, including its background, is fixed at the
same height as the iPhone keyboard to respect the
[iOS Human Interface Guidelines](https://developer.apple.com/ios/human-interface-guidelines/overview/themes/#//apple_ref/doc/uid/TP40006556-CH15-SW3).
The default `width` on iOS is 320px and the `height` is 228px.
The contents of the picker are sized to fit the picker, which may cut off text
in the picker rows. Adding views to picker rows is also supported on iOS.

On iPad, Apple recommends using a picker only in a popover.  Since the size of the picker
cannot be adjusted, it is not suitable for the main screen.

**Note:** you can only set the [columns](https://titaniumsdk.com/docs/sdk/Titanium.UI.Picker.md#columns) property for the plain picker.
If you set the [type](https://titaniumsdk.com/docs/sdk/Titanium.UI.Picker.md#type) property to anything else except
`Titanium.UI.PICKER_TYPE_PLAIN`, you cannot modify the picker's columns.

## Example: Multi-Column Picker using Alloy XML Markup

Creates a picker with two columns.  You can optionally use `Column` and `Row` as shorthand
notation for `PickerColumn` and `PickerRow`, respectively.

`app/views/index.xml`:
``` xml
<Alloy>
    <Window id="win" backgroundColor="white" layout="vertical" exitOnClose="true">
        <Picker id="picker" top="50" selectionIndicator="true" useSpinner="true">
            <PickerColumn id="column1">
                <PickerRow title="Bananas"/>
                <PickerRow title="Strawberries"/>
                <PickerRow title="Mangos"/>
                <PickerRow title="Grapes"/>
            </PickerColumn>
            <!-- Picker shorthand notation -->
            <Column id="column2">
                <Row title="red"/>
                <Row title="green"/>
                <Row title="blue"/>
                <Row title="orange"/>
            </Column>
        </Picker>
    </Window>
</Alloy>
```

`app/controllers/index.js`:
``` js
$.win.open();
```

## Example: Date Picker using Alloy XML Markup

Creates a date picker, then monitors the `change` event to see when the user updates the picker.

For the date string, use string values accepted by the moment.js constructor in the XML and TSS files.
If you are defining dates in the controller code, use a JavaScript Date object.

`app/views/index.xml`:
``` xml
<Alloy>
    <Window backgroundColor="blue">
        <Picker id="picker"
          onChange="report"
          type="Ti.UI.PICKER_TYPE_DATE"
          minDate="2014,4,1"
          maxDate="May 1, 2014 12:00:00"
          value="2014-04-15T12:00:00">
        </Picker>
    </Window>
</Alloy>
```

`app/controllers/index.js`:
``` js
function report(e) {
    Ti.API.info('User selected: ' + e.value);
}

$.index.open();
```

## Example: Basic Single Column Picker

Create a one-column, platform-specific style, picker and automatically select a row.

``` js
Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow({
  exitOnClose: true,
  layout: 'vertical'
});

var picker = Ti.UI.createPicker({
  top:50
});

var data = [];
data[0]=Ti.UI.createPickerRow({title:'Bananas'});
data[1]=Ti.UI.createPickerRow({title:'Strawberries'});
data[2]=Ti.UI.createPickerRow({title:'Mangos'});
data[3]=Ti.UI.createPickerRow({title:'Grapes'});

picker.add(data);
picker.selectionIndicator = true;

win.add(picker);
win.open();

// must be after picker has been displayed
picker.setSelectedRow(0, 2, false); // select Mangos
```

## Example: Multi-Column Picker

Create a two-column, platform-specific style, picker and automatically select a row in
each column.

``` js
Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow({
  exitOnClose: true,
  layout: 'vertical'
});

var picker = Ti.UI.createPicker({
  top:50,
  useSpinner: true
});
picker.selectionIndicator = true;

var fruit = [ 'Bananas', 'Strawberries', 'Mangos', 'Grapes' ];
var color = [ 'red', 'green', 'blue', 'orange' ];

var column1 = Ti.UI.createPickerColumn();

for(var i=0, ilen=fruit.length; i<ilen; i++){
  var row = Ti.UI.createPickerRow({
    title: fruit[i]
  });
  column1.addRow(row);
}

var column2 = Ti.UI.createPickerColumn();

for(var i=0, ilen=color.length; i<ilen; i++){
  var row = Ti.UI.createPickerRow({ title: color[i] });
  column2.addRow(row);
}

picker.add([column1,column2]);

win.add(picker);

win.open();

// must be after picker has been displayed
picker.setSelectedRow(0, 2, false); // select Mangos
picker.setSelectedRow(1, 3, false); // select Orange
```

## Example: Date Picker

Create a date picker and handle the subsequent user action.

``` js
Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow({
  exitOnClose: true,
  layout: 'vertical'
});

var picker = Ti.UI.createPicker({
  type:Ti.UI.PICKER_TYPE_DATE,
  minDate:new Date(2009,0,1),
  maxDate:new Date(2014,11,31),
  value:new Date(2014,3,12),
  top:50
});

win.add(picker);
win.open();

picker.addEventListener('change',function(e){
  Ti.API.info("User selected date: " + e.value.toLocaleString());
});
```

## Example: Date Picker using showDatePickerDialog() (Android only)

Create a date picker that is automatically displayed as a modal dialog and handle the
subsequent user action.

``` js
Ti.UI.backgroundColor = 'white';

var picker = Ti.UI.createPicker({
  type:Ti.UI.PICKER_TYPE_DATE,
  minDate:new Date(2009,0,1),
  maxDate:new Date(2014,11,31),
  value:new Date(2014,3,12)
});

picker.showDatePickerDialog({
  value: new Date(2010,8,1),
  callback: function(e) {
    if (e.cancel) {
      Ti.API.info('User canceled dialog');
    } else {
      Ti.API.info('User selected date: ' + e.value);
    }
  }
});
```

## Properties

### backgroundColor

- Type: String | Titanium.UI.Color
- Platforms: Android, iPhone, iPad, macOS
- Since: Titanium SDK iPhone 5.2.0, iPad 5.2.0, Android 0.9.0
- Default: `White (iOS), Transparent (Android)`

Background color of the picker, as a color name or hex triplet.

For information about color values, see the "Colors" section of [Titanium.UI](https://titaniumsdk.com/docs/sdk/Titanium.UI.md).

Android: If you want to change the backgroundColor you have to set the `borderStyle` to
`Ti.UI.INPUT_BORDERSTYLE_ROUNDED` or `Ti.UI.INPUT_BORDERSTYLE_NONE`

### borderStyle

- Type: Number
- Platforms: Android
- Since: Titanium SDK 10.0.1
- Default: `<Titanium.UI.INPUT_BORDERSTYLE_FILLED>`

Border style to use when picker is shown as a text field or drop-down field.

This is an Android only property which only applies to pickers of type:

* [PICKER_TYPE_DATE](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE) or [PICKER_TYPE_TIME](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_TIME)
that also have [datePickerStyle](https://titaniumsdk.com/docs/sdk/Titanium.UI.Picker.md#datePickerStyle) set to
[DATE_PICKER_STYLE_COMPACT](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#DATE_PICKER_STYLE_COMPACT).

* [PICKER_TYPE_PLAIN](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_PLAIN) that also have property
[useSpinner](https://titaniumsdk.com/docs/sdk/Titanium.UI.Picker.md#useSpinner) set `false` to show a drop-down picker.

Accepts: `Titanium.UI.INPUT_BORDERSTYLE_BEZEL`, `Titanium.UI.INPUT_BORDERSTYLE_FILLED`, `Titanium.UI.INPUT_BORDERSTYLE_LINE`, `Titanium.UI.INPUT_BORDERSTYLE_NONE`, `Titanium.UI.INPUT_BORDERSTYLE_ROUNDED`, `Titanium.UI.INPUT_BORDERSTYLE_UNDERLINED`

### calendarViewShown

- Type: Boolean
- Platforms: Android
- Default: `false`

Determines whether the calenderView is visible.

If 'calendarViewShown' is 'true', the calenderView is visible

### color

- Type: String | Titanium.UI.Color
- Platforms: Android
- Since: Titanium SDK 12.0.0

Text color of the Picker

### columns

- Type: Array<Titanium.UI.PickerColumn>
- Platforms: Android, iPhone, iPad, macOS

Columns used for this picker, as an array of [Titanium.UI.PickerColumn](https://titaniumsdk.com/docs/sdk/Titanium.UI.PickerColumn.md) objects.

You can only set columns for the plain picker.  If you set the type to anything
else except `Titanium.UI.PICKER_TYPE_PLAIN`, you cannot modify the columns.

In an Alloy application you can specify this property with a `<PickerColumn>` (or `<Column>`)
element that contains one or more `<PickerRow>` (or `<Row>`) elements, as shown below:

``` xml
<Alloy>
    <Window>
        <Picker useSpinner="true">
            <PickerColumn id="column1">
                <PickerRow title="Bananas"/>
                <PickerRow title="Strawberries"/>
                <PickerRow title="Mangos"/>
            </PickerColumn>
            <!-- Picker shorthand notation -->
            <Column id="column2">
                <Row title="red"/>
                <Row title="green"/>
                <Row title="blue"/>
            </Column>
        </Picker>
    </Window>
</Alloy>
```

### countDownDuration

- Type: Number
- Platforms: iPhone, iPad, macOS

Duration in milliseconds used for a Countdown Timer picker.

Applicable to [Titanium.UI.PICKER_TYPE_COUNT_DOWN_TIMER](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_COUNT_DOWN_TIMER) picker types.

### datePickerStyle

- Type: Number
- Platforms: Android, iPhone, iPad, macOS
- Since: Titanium SDK Android 10.0.1, iPhone 9.2.0, iPad 9.2.0, macOS 9.2.0
- Requires: iOS 13.4+
- Default: `<Titanium.UI.DATE_PICKER_STYLE_AUTOMATIC>`

Determines how a date or time picker should appear.

Used to display the picker has calendar/clock view, as wheel spinners, or
as a field which displays selection dialog when tapped on.

This property is ignored if the [type](https://titaniumsdk.com/docs/sdk/Titanium.UI.Picker.md#type) property is set to
[Titanium.UI.PICKER_TYPE_PLAIN](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_PLAIN).

Accepts: `Titanium.UI.DATE_PICKER_STYLE_AUTOMATIC`, `Titanium.UI.DATE_PICKER_STYLE_COMPACT`, `Titanium.UI.DATE_PICKER_STYLE_INLINE`, `Titanium.UI.DATE_PICKER_STYLE_WHEELS`

### dateTimeColor

- Type: String | Titanium.UI.Color
- Platforms: iPhone, iPad
- Since: Titanium SDK 5.2.0
- Default: `black`

Sets the text color of date- and time-pickers.

Applicable to [Titanium.UI.PICKER_TYPE_TIME](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_TIME) and [Titanium.UI.PICKER_TYPE_DATE_AND_TIME](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE_AND_TIME) picker types.
The picker type [Titanium.UI.PICKER_TYPE_DATE](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE) does not support text customizing as stated in the
[UIKit User Interface Catalog](https://developer.apple.com/documentation/uikit/uidatepicker).

Important: On iOS 14+, you also have to set the [Titanium.UI.Picker.datePickerStyle](https://titaniumsdk.com/docs/sdk/Titanium.UI.Picker.md#datePickerStyle) to
[Titanium.UI.DATE_PICKER_STYLE_WHEELS](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#DATE_PICKER_STYLE_WHEELS) in order to use this property.

### font

- Type: Font
- Platforms: Android

Font to use for text.

Only applicable to [Titanium.UI.PICKER_TYPE_DATE](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE) and [Titanium.UI.PICKER_TYPE_TIME](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_TIME)
picker types for android. For [Titanium.UI.PICKER_TYPE_PLAIN](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_PLAIN), refer to [Titanium.UI.PickerColumn](https://titaniumsdk.com/docs/sdk/Titanium.UI.PickerColumn.md)
for android, and [Titanium.UI.PickerRow](https://titaniumsdk.com/docs/sdk/Titanium.UI.PickerRow.md) for iphone / ipad.

### format24

- Type: Boolean
- Platforms: Android
- Default: `false`

Determines whether the Time pickers display in 24-hour or 12-hour clock format.

Only applcable to pickers of type [Titanium.UI.PICKER_TYPE_TIME](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_TIME).

When this property is set `true`, a time picker is displayed with hours 0 through 23.
When set `false`, hours will be 1 through 12 with am/pm controls.

### hintText

- Type: String
- Platforms: Android
- Since: Titanium SDK 10.0.1
- Default: `undefined`

Text to be shown above date/time when picker is shown as a text field or drop-down field.

This is an Android only property which only applies to pickers of type:

* [PICKER_TYPE_DATE](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE) or [PICKER_TYPE_TIME](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_TIME)
that also have [datePickerStyle](https://titaniumsdk.com/docs/sdk/Titanium.UI.Picker.md#datePickerStyle) set to
[DATE_PICKER_STYLE_COMPACT](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#DATE_PICKER_STYLE_COMPACT).

* [PICKER_TYPE_PLAIN](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_PLAIN) that also have property
[useSpinner](https://titaniumsdk.com/docs/sdk/Titanium.UI.Picker.md#useSpinner) set `false` to show a drop-down picker.

### locale

- Type: String
- Platforms: Android
- Default: `System Settings`

Locale used when displaying Date and Time picker values.

Applicable to [Titanium.UI.PICKER_TYPE_DATE](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE), [Titanium.UI.PICKER_TYPE_TIME](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_TIME) and
[Titanium.UI.PICKER_TYPE_DATE_AND_TIME](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE_AND_TIME) picker types.

Locale must be represented as a combination of ISO 2-letter language and country codes.
For example, `en-US` or `en-GB`. See the
[ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) and
[ISO 3166-1 alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
sections of wikipedia for reference.

On iOS, the system locale is always used.

### maxDate

- Type: Date
- Platforms: Android, iPhone, iPad, macOS

Maximum date displayed when a Date picker is in use.

Applicable to [Titanium.UI.PICKER_TYPE_DATE](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE) and [Titanium.UI.PICKER_TYPE_DATE_AND_TIME](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE_AND_TIME)
picker types.

For JavaScript files, use a JavaScript Date object.

For Alloy XML and TSS files, use a date string that can be parsed by the
[moment.js constructor](http://momentjs.com/docs/#/parsing/string/),
which includes ISO-8601 and RFC2822 dates.

This property is ignored when `maxDate` is less than `minDate`.

### minDate

- Type: Date
- Platforms: Android, iPhone, iPad, macOS

Minimum date displayed when a Date picker is in use.

Applicable to [Titanium.UI.PICKER_TYPE_DATE](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE) and [Titanium.UI.PICKER_TYPE_DATE_AND_TIME](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE_AND_TIME)
picker types.

For JavaScript files, use a JavaScript Date object.

For Alloy XML and TSS files, use a date string that can be parsed by the
[moment.js constructor](http://momentjs.com/docs/#/parsing/string/),
which includes ISO-8601 and RFC2822 dates.

This property is ignored when `maxDate` is less than `minDate`.

### minuteInterval

- Type: Number
- Platforms: iPhone, iPad, macOS
- Default: `1`

Interval in minutes displayed when one of the Time types of pickers is in use.

Applicable to [Titanium.UI.PICKER_TYPE_TIME](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_TIME) and [Titanium.UI.PICKER_TYPE_DATE_AND_TIME](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE_AND_TIME)
picker types.

The minimum permitted value is 1 and maximum is 30. If the value cannot be evenly divided
into 60, the default value is used.

### nativeSpinner

- Type: Boolean
- Platforms: Android
- Since: Titanium SDK 5.4.0
- Default: `false`

Determines if a multicolumn spinner or single column drop-down picker should be used.

This property is intended to be used by time picker types.

If `true`, Android will show hour, minute, and am/pm spinners like iOS.

If `false`, Android will display a clock view.

If `undefined` with Titanium 10.0.1 or higher, the
[datePickerStyle](https://titaniumsdk.com/docs/sdk/Titanium.UI.Picker.md#datePickerStyle) property is used.

As of Titanium 10.0.1, this property has the same effect as the
[useSpinner](https://titaniumsdk.com/docs/sdk/Titanium.UI.Picker.md#useSpinner) property which also shows a native spinner.

``` js
const picker = Ti.UI.createPicker({
    type: Ti.UI.PICKER_TYPE_TIME,
    nativeSpinner: true,
    format24: false,
    minuteInterval: 4,
    minDate: new Date(2018, 5, 24),
    maxDate: new Date(2020, 5, 24),
    value: new Date(2019, 5, 24)
});
```

### overrideUserInterfaceStyle

- Type: Number
- Platforms: Android, iPhone, iPad, macOS
- Since: Titanium SDK 12.4.0
- Requires: iOS 13.0+
- Default: `Titanium.UI.USER_INTERFACE_STYLE_UNSPECIFIED`

Forces the picker to used assigned theme instead of the system theme.

When set to [USER_INTERFACE_STYLE_DARK](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#USER_INTERFACE_STYLE_DARK) or
[USER_INTERFACE_STYLE_LIGHT](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#USER_INTERFACE_STYLE_LIGHT), the picker will ignore
the system's current theme and use the theme assigned to this property instead.

When set to [USER_INTERFACE_STYLE_UNSPECIFIED](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#USER_INTERFACE_STYLE_UNSPECIFIED),
the picker will use the system's current theme.

Accepts: `Titanium.UI.USER_INTERFACE_STYLE_DARK`, `Titanium.UI.USER_INTERFACE_STYLE_LIGHT`, `Titanium.UI.USER_INTERFACE_STYLE_UNSPECIFIED`

### selectionIndicator

- Type: Boolean
- Platforms: Android
- Default: `true`
- DEPRECATED since 10.0.1. This property is ignored as of Titanium 10.0.1.

Determines whether the visual selection indicator is shown.

As of Titanium 10.0.1, this property will be ignored and Android will always show an indicator.

### selectionOpens

- Type: Boolean
- Platforms: Android
- Since: Titanium SDK 5.0.0
- Default: `false (Android)`

Determines whether calling the method `setSelectedRow` opens when called

If `true`, selection will open when `setSelectedRow` is called.

If `false`, selection will not open when `setSelectedRow` is called.

### textAlign

- Type: String | Number
- Platforms: Android
- Since: Titanium SDK 12.4.0
- Default: `<Titanium.UI.TEXT_ALIGNMENT_LEFT>,`

Horizontal text alignment of the date picker when using [Titanium.UI.PICKER_TYPE_DATE](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE).

Accepts: `Titanium.UI.TEXT_ALIGNMENT_CENTER`, `Titanium.UI.TEXT_ALIGNMENT_JUSTIFY`, `Titanium.UI.TEXT_ALIGNMENT_LEFT`, `Titanium.UI.TEXT_ALIGNMENT_RIGHT`

### type

- Type: Number
- Platforms: Android, iPhone, iPad, macOS
- Default: `<Titanium.UI.PICKER_TYPE_PLAIN>`

Determines the type of picker displayed

You can only set columns for the plain picker.  If you set the type to anything
else except `Titanium.UI.PICKER_TYPE_PLAIN`, you cannot modify the columns.

`PICKER_TYPE_DATE_AND_TIME` is only available for iOS.
`PICKER_TYPE_COUNT_DOWN_TIMER` is only available for iOS.

Accepts: `Titanium.UI.PICKER_TYPE_COUNT_DOWN_TIMER`, `Titanium.UI.PICKER_TYPE_DATE`, `Titanium.UI.PICKER_TYPE_DATE_AND_TIME`, `Titanium.UI.PICKER_TYPE_PLAIN`, `Titanium.UI.PICKER_TYPE_TIME`

### useSpinner

- Type: Boolean
- Platforms: Android
- Default: `false`

Determines if a multicolumn spinner or single column drop-down picker should be used.

This property is intended to be used by plain picker types. When set on date/time pickers,
this property will override the [datePickerStyle](https://titaniumsdk.com/docs/sdk/Titanium.UI.Picker.md#datePickerStyle) property.

If `true`, Android will show spinners for each column like iOS.

If `false`, Android will display the 1st column as a drop-down list picker and all other
columns will be ignored.

As of Titanium 10.0.1, this property shows a native Android spinner widget like how the
[nativeSpinner](https://titaniumsdk.com/docs/sdk/Titanium.UI.Picker.md#nativeSpinner) property worked in older versions.
On older Titanium versions, this property shows a non-native custom spinner view.

### value

- Type: Date
- Platforms: Android, iPhone, iPad, macOS

Date and time value for Date and Time pickers.

Applicable to [Titanium.UI.PICKER_TYPE_DATE](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE), [Titanium.UI.PICKER_TYPE_TIME](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_TIME) and [Titanium.UI.PICKER_TYPE_DATE_AND_TIME](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE_AND_TIME)
picker types.

For JavaScript files, use a JavaScript Date object.

For Alloy XML and TSS files, use a date string that can be parsed by the
[moment.js constructor](http://momentjs.com/docs/#/parsing/string/),
which includes ISO-8601 and RFC2822 dates.

### visibleItems

- Type: Number
- Platforms: Android
- Default: `5`
- DEPRECATED since 10.0.1. This property is ignored as of Titanium 10.0.1.

Number of visible rows to display. This is only applicable to a plain picker and when the
`useSpinner` is `true`.

The spinner-style Android picker shows 5 rows by default; one selected in the middle and 2
above and below. Set to an odd number to ensure the selected row is in the middle.

## Methods

### add

- Platforms: Android, iPhone, iPad, macOS

Adds rows or columns to the picker.

Once you use this method to add rows and columns to a picker, you cannot remove or
manipulate them.

Parameters:

- `data` (Array<Titanium.UI.PickerRow> | Titanium.UI.PickerRow | Array<Titanium.UI.PickerColumn> | Titanium.UI.PickerColumn): A row, set of rows, a column of rows or a set of columns of rows. When this method is used to add a row or set of rows, a single-column picker is created.

### getSelectedRow

- Platforms: Android, iPhone, iPad, macOS

Gets the selected row for a column, or `null` if none exists.

Parameters:

- `index` (Number): A column index.

Returns: Titanium.UI.PickerRow

### reloadColumn

- Platforms: iPhone, iPad, macOS

Repopulates values for a column.

Parameters:

- `column` (Titanium.UI.PickerColumn): Column to repopulate.

### setSelectedRow

- Platforms: Android, iPhone, iPad, macOS

Selects a column's row.

On iOS, this method must be called after the picker is rendered.
On Android, the picker has a default value of 0 for both column and row index.

Parameters:

- `column` (Number): A column index.
- `row` (Number): A row index.
- `animated` (Boolean, optional): Determines whether the selection should be animated. (iPhone, iPad-only) Default: `true`.

### setValue

- Platforms: iPhone, iPad, macOS
- DEPRECATED since 10.0.0, removed in 10.0.0. Use the <Titanium.Picker.value> property instead

Sets the date and time value property for Date pickers.

Applicable to the [Titanium.UI.PICKER_TYPE_DATE](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE) and [Titanium.UI.PICKER_TYPE_DATE_AND_TIME](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE_AND_TIME)
picker types.

Parameters:

- `date` (Date): A Javascript `Date` object.

Returns: Titanium.UI.PickerRow

### showDatePickerDialog

- Platforms: Android

Shows Date picker as a modal dialog.

Applicable to the [Titanium.UI.PICKER_TYPE_DATE](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_DATE) picker type.

See "Date Picker using showDatePickerDialog()" for an example.

Parameters:

- `dictObj` (Object): Dictionary object with a subset of `Titanium.UI.Picker` properties and a callback defined. Acceptable object properties are `callback`, `title` and `value`. Property `okButtonTitle` is only supported on Titanium versions older than 10.0.0.

### showTimePickerDialog

- Platforms: Android

Shows Time picker as a modal dialog.

Applicable to the [Titanium.UI.PICKER_TYPE_TIME](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_TIME) picker type.

See "Date Picker using showDatePickerDialog()" for a similar example.

Parameters:

- `dictObj` (Object): Dictionary object with a subset of `Titanium.UI.Picker` properties and a callback defined. Acceptable object properties are `callback`, `format24`, `title` and `value`. Property `okButtonTitle` is only supported on Titanium versions older than 10.0.0.

## Events

### change

- Platforms: Android, iPhone, iPad, macOS

Fired when the value of any column's row is changed.

Event properties:

- `columnIndex` (Number): Selected column index. On iOS, only applicable to [Titanium.UI.PICKER_TYPE_PLAIN](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_PLAIN) picker types.
- `rowIndex` (Number): Selected row index. On iOS, only applicable to [Titanium.UI.PICKER_TYPE_PLAIN](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_PLAIN) picker types.
- `column` (Titanium.UI.PickerColumn): The column object. On iOS, only applicable to [Titanium.UI.PICKER_TYPE_PLAIN](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_PLAIN) picker types.
- `countDownDuration` (Number): The selected duration in milliseconds. Applicable to [Titanium.UI.PICKER_TYPE_COUNT_DOWN_TIMER](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_COUNT_DOWN_TIMER) picker types.
- `value` (String): The selected value. Applicable to date/time pickers only. This property is read-only on Android.
- `row` (Titanium.UI.PickerRow): The row object. On iOS, only applicable to [Titanium.UI.PICKER_TYPE_PLAIN](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_PLAIN) picker types.
- `selectedValue` (Array<String>): Array of selected values, one element per column in the picker. Applicable to [Titanium.UI.PICKER_TYPE_PLAIN](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#PICKER_TYPE_PLAIN) picker types.

### click

- Platforms: Android
- Since: Titanium SDK 3.0.0

Fired when the device detects a click against the view.

This event is only available for non-spinner plain pickers.

Event properties:

- `x` (Number): X coordinate of the event from the `source` view's coordinate system.
- `y` (Number): Y coordinate of the event from the `source` view's coordinate system.

## Inherited members

81 members are inherited. Each is documented on the type that declares it.

- [Titanium.Proxy](https://titaniumsdk.com/docs/sdk/12.6.2/Titanium.Proxy.md): `addEventListener`, `apiName`, `applyProperties`, `bubbleParent`, `fireEvent`, `lifecycleContainer`, `removeEventListener`
- [Titanium.UI.View](https://titaniumsdk.com/docs/sdk/12.6.2/Titanium.UI.View.md): `accessibilityDisableLongPress`, `accessibilityHidden`, `accessibilityHint`, `accessibilityLabel`, `accessibilityValue`, `animate`, `animatedCenter`, `borderColor`, `borderRadius`, `borderWidth`, `bottom`, `clearMotionEffects`, `clipMode`, `convertPointToView`, `dblclick`, `doubletap`, `elevation`, `filterTouchesWhenObscured`, `focus`, `focusable`, `getViewById`, `height`, `hiddenBehavior`, `hide`, `horizontalMotionEffect`, `horizontalWrap`, `id`, `insertAt`, `keepScreenOn`, `keypressed`, `left`, `longclick`, `longpress`, `opacity`, `overrideCurrentAnimation`, `pinch`, `postlayout`, `previewContext`, `pullBackgroundColor`, `rect`, `right`, `rotation`, `rotationX`, `rotationY`, `scaleX`, `scaleY`, `show`, `singletap`, `size`, `softKeyboardOnFocus`, `stopAnimation`, `swipe`, `toImage`, `tooltip`, `top`, `touchEnabled`, `touchFeedback`, `touchFeedbackColor`, `touchcancel`, `touchend`, `touchmove`, `touchstart`, `transform`, `transitionName`, `translationX`, `translationY`, `translationZ`, `twofingertap`, `verticalMotionEffect`, `viewShadowColor`, `viewShadowOffset`, `viewShadowRadius`, `visible`, `width`

---

- This corpus documents Titanium SDK 13.4.1. Anything here that does not name a version describes 13.4.1.
- Titanium is maintained by TiDev. The Appcelerator toolchain is retired: there is no `appc` CLI, no Appcelerator Studio and no hosted build service. The supported CLI is `titanium` on npm, invoked as `ti`.

