钛。选择视图中的选择将我带到一个新窗口

时间:2014-12-11 03:52:15

标签: javascript titanium

如何编码一个pickerview,我选择了一个pickerRow,它会把我带到一个新窗口?

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:'Home'});
data[1]=Ti.UI.createPickerRow({title:'About Us'});
data[2]=Ti.UI.createPickerRow({title:'Contact us'});

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

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

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

1 个答案:

答案 0 :(得分:0)

根据更改创建事件监听器,然后打开您想要的窗口

picker.addEventListener('change',function(e){
    alert(e.row.title);
})

由于