Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Medium
-
Resolution: Fixed
-
Affects Version/s: Release 2.1.0, Release 1.8.3
-
Fix Version/s: Sprint 2012-16 API, Release 2.1.2, Release 3.0.0
-
Component/s: iOS
-
Labels:
-
Environment:
Titanium Studio, build: 2.1.0.201206251749
iOS 5
Description
By default 'Answer 5' should be selected on starting the app but it selects "Answer 0" on iOS. This code works fine on Android but not on iOS.
var win = Ti.UI.createWindow({
|
layout: 'vertical'
|
});
|
|
var picker = Ti.UI.createPicker({
|
type: Ti.UI.PICKER_TYPE_PLAIN,
|
selectionIndicator: true
|
});
|
|
|
var data = [];
|
var answerLoop = 0;
|
|
// add answers
|
for (answerLoop = 0; answerLoop < 11; answerLoop++) {
|
data.push(Ti.UI.createPickerRow({
|
title: 'Answer ' + answerLoop,
|
custom_item: answerLoop
|
}));
|
}
|
|
picker.add(data);
|
|
// THIS IS WHERE THE BUG IS
|
// This should selected the value 'Answer 5' but as you can see, Answer 1 is selected at startup
|
picker.setSelectedRow(0, 5, true);
|
|
var selectedButton = Ti.UI.createButton({
|
title: 'Select Answer 6',
|
width: 300,
|
height: 'auto'
|
});
|
selectedButton.addEventListener('click', function(e) {
|
picker.setSelectedRow(0, 6, true);
|
});
|
|
win.add(picker);
|
win.add(selectedButton);
|
|
win.open();
|
|
STEPS TO REPRODUCE:
1. Load the above code into app.js
2. Run the project on iPhone simulator.