I want to get some values to the picker dynamically. Statically it is performing well. But when I want to add picker row dynamically from calling web service, there is an occurrence of NSRangeException. Whether the array having data and I am able to alert that data. I am using Titanium SDK for this iphone application.
我想动态地为选择器获取一些值。静态地表现良好。但是当我想从调用Web服务动态添加选择器行时,会出现NSRangeException。阵列是否有数据,我是否能够提醒该数据。我正在为此iphone应用程序使用Titanium SDK。
if(gameTypeName.length>0){
alert(gameType.length);
picker.add(gameTypeName);
}
The array is creating as:
该阵列创建为:
var typeName = college[j].GameTypeName;
gameTypeName.push(Titanium.UI.createPickerRow({title:typeName}));
Whether it is working fine with static data as:
它是否与静态数据一起工作正常:
var picker_data = [
Titanium.UI.createPickerRow({title:'Title 1',value:'1'}),
Titanium.UI.createPickerRow({title:'Title 2',value:'2'})
];
picker.add(picker_data);
2 个解决方案
#1
1
Believe it or not, the Picker doesn't have a "Value" property.
信不信由你,Picker没有“价值”属性。
#2
0
You can use pickerView. But, easy to use Table View. you set array data in you TableView (tableView.data =;). and for get value
你可以使用pickerView。但是,易于使用Table View。你在TableView(tableView.data =;)中设置数组数据。并获得价值
tableView.addEventListener('click',function(e){
// own your requirement
Ti.API.log(e);
});
I think this is easy to use and good looking. If, you want to show and hide. then you can use animation or window.modal property.
我认为这很容易使用,外观漂亮。如果,你想显示和隐藏。那么你可以使用动画或window.modal属性。
var win = Ti.UI.createWindow({});
win.add(tableview);
win.open({modal:true});
#1
1
Believe it or not, the Picker doesn't have a "Value" property.
信不信由你,Picker没有“价值”属性。
#2
0
You can use pickerView. But, easy to use Table View. you set array data in you TableView (tableView.data =;). and for get value
你可以使用pickerView。但是,易于使用Table View。你在TableView(tableView.data =;)中设置数组数据。并获得价值
tableView.addEventListener('click',function(e){
// own your requirement
Ti.API.log(e);
});
I think this is easy to use and good looking. If, you want to show and hide. then you can use animation or window.modal property.
我认为这很容易使用,外观漂亮。如果,你想显示和隐藏。那么你可以使用动画或window.modal属性。
var win = Ti.UI.createWindow({});
win.add(tableview);
win.open({modal:true});