Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7445] iOS: UI.Picker.setSelectedRow method does not work unless picker already rendered

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionCannot Reproduce
Resolution Date2017-05-24T21:15:05.000+0000
Affected Version/sRelease 1.8.0.1
Fix Version/sn/a
ComponentsiOS
Labelsparity
ReporterPaul Dowsett
AssigneeIngo Muschenetz
Created2012-01-26T19:06:13.000+0000
Updated2017-05-24T21:15:05.000+0000

Description

Problem

The [Titanium.UI.Picker.setSelectedRow](http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.Picker.setSelectedRow-method.html) method does not work unless the picker is rendered. Note that this works correctly on Android with 1.8.0.1.

Test case

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);
picker.setSelectedRow(0, 2, false); // move after win.open() to workaround issue

win.open();

Discussions

Stramer stated in [this](https://github.com/appcelerator/titanium_mobile/pull/1269/files#r389725) comment that this is considered a bug.

Comments

  1. Lee Morris 2017-05-24

    Closing this ticket as the issue cannot be reproduced with the following environment; iPhone 7 (10.2) MacOS 10.11.6 (15G31) Studio 4.9.0.201705021158 Ti SDK 6.1.0.v20170519131839 Appc NPM 4.2.9 Appc CLI 6.2.1 Ti CLI 5.0.13 Alloy 1.9.11 Arrow 2.0.0 Xcode 8.2 (8C38) Node v4.8.2 Java 1.7.0_80

JSON Source