# Titanium.UI.PickerRow

> A picker row, representing a selectable item in a [Titanium.UI.Picker](https://titaniumsdk.com/docs/sdk/Titanium.UI.Picker.md).

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

Use the [Titanium.UI.createPickerRow](https://titaniumsdk.com/docs/sdk/Titanium.UI.md#createPickerRow) method to create a picker row control. In an Alloy application,
you can use a **`<PickerRow>`** element inside a `<PickerColumn>` element. You can also use `<Row>`
as a shorthand for `<PickerRow>` (see Examples).

Views added to picker rows is only supported on iOS.

## Example: Custom View for Row (iOS only)

Create a two-column picker, with the first column containing a child view, and automatically
select a row in each column.

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

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();

  var label = Ti.UI.createLabel({
    color:'red',
    font:{fontSize:20,fontWeight:'bold'},
    text: fruit[i],
    textAlign:'left',
    width:'126'
  });

  row.add(label);
  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],
    font: {fontSize:30}
  });
  column2.addRow(row);
}

var picker = Ti.UI.createPicker({
  top:50,
  columns: [column1, column2],
  selectionIndicator: true
});

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: Alloy XML Markup

Previous example as an Alloy view.

pickerrowexample.xml
``` xml
<Alloy>
    <Window id="win" backgroundColor="white" layout="vertical" exitOnClose="true">
        <Picker id="picker" top="50" selectionIndicator="true">
            <PickerColumn id="column1">

                <!-- On iOS, views can be added to picker rows -->
                <PickerRow>
                    <Label color="red" textAlign="left" width="126">Bananas</Label>
                </PickerRow>
                <PickerRow>
                    <Label color="red" textAlign="left" width="126">Strawberries</Label>
                </PickerRow>
                <PickerRow>
                    <Label color="red" textAlign="left" width="126">Mangos</Label>
                </PickerRow>
                <PickerRow>
                    <Label color="red" textAlign="left" width="126">Grapes</Label>
                </PickerRow>
            </PickerColumn>

            <!-- Picker shorthand notation -->
            <Column id="column2">
                <Row title="red"/>
                <Row title="green"/>
                <Row title="blue"/>
                <Row title="orange"/>
            </Column>
        </Picker>
    </Window>
</Alloy>
```

pickerrowexample.js:
``` js
$.picker.setSelectedRow(0, 2, false);
$.picker.setSelectedRow(1, 3, false);
```

## Properties

### color

- Type: String | Titanium.UI.Color
- Platforms: Android, iPhone, iPad, macOS
- Since: Titanium SDK 5.4.0

Color of the item text, 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).

### font

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

Font to use for the item text.

### title

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

Item text.

## Methods

### add

- Platforms: iPhone, iPad, macOS

Adds a child view to this picker row, to provide a custom row.

Parameters:

- `view` (Titanium.UI.View): A view object.

## Inherited members

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

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

---

- 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`.

