Skip to content

Instantly share code, notes, and snippets.

@exclusiveTanim
Created October 11, 2019 15:24
Show Gist options
  • Save exclusiveTanim/fa987633051c3aeee113081110147fbb to your computer and use it in GitHub Desktop.
Save exclusiveTanim/fa987633051c3aeee113081110147fbb to your computer and use it in GitHub Desktop.
iOS test code
var win = Ti.UI.createWindow({
backgroundColor : 'white'
});
var myTemplate = {
childTemplates : [{// Title
type: 'Ti.UI.Label',
// Use a label for the
bindId : 'info',
// Maps to a custom info property of the item data
properties : {// Sets the label properties
color: 'black',
font : {
fontFamily : 'Arial',
fontSize : '20dp',
fontWeight : 'bold'
},
left : '60dp',
top : 0,
}
}, {// Subtitle
type: 'Ti.UI.Label',
// Use a label for the subtitle
bindId: 'es_info',
// Maps to a custom es_info property of the item data
properties : {// Sets the label properties
color: 'white',
font : {
fontFamily : 'Arial',
fontSize : '14dp'
},
left : '60dp',
top : '25dp',
backgroundColor : 'red'
}
}]
};
var listView = Ti.UI.createListView({
templates : {
'template' : myTemplate
},
defaultItemTemplate : 'template'
});
var sections = [];
var fruitSection = Ti.UI.createListSection({
headerTitle : 'Fruits / Frutas'
});
var fruitDataSet = [{
info : {
text : 'Apple'
},
es_info : {
text : 'Manzana'
},
}, {
info : {
text : 'Banana'
},
es_info : {
text : 'Banana'
},
}];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);
var vegSection = Ti.UI.createListSection({
headerTitle : 'Vegetables / Verduras'
});
var vegDataSet = [{
info : {
text : 'Carrot'
},
es_info : {
text : 'Zanahoria'
}
}, {
info : {
text : 'Potato'
},
es_info : {
text : 'Patata'
}
}];
vegSection.setItems(vegDataSet);
sections.push(vegSection);
listView.setSections(sections);
win.add(listView);
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment