Created
October 11, 2019 15:24
-
-
Save exclusiveTanim/fa987633051c3aeee113081110147fbb to your computer and use it in GitHub Desktop.
iOS test code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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