I'm using Titanium Appcelerator and I've been trying to figure out how i can create a section within my app, where users can store there setting by checking a number of checkboxes. Any help is appreciated.
for iphone or android?
/* store sections in here */
var mySections = [];
/* create section */
var mySection[0] = Ti.UI.createTableViewSection({
headerTitle:"first section"
})
/* tableview row to store checkbox */
var tableviewrow0 = Ti.UI.createTableViewRow();
/* if you don't want to build your own UI element you need
* to use the provided elements. checkboxes aren't standard
* ui elements, so you need to use switcher
*/
var switcher0 = Ti.UI.createSwitcher({
value: true, // or false
right: 10 // place it onto right side
});
tableviewrow0.add(switcher0);
/* label */
var label0 = Ti.UI.createLabel({
value:"option one",
textAlign:"left",
left:10
});
tableviewrow0.add(label0);
/* add row to section*/
mySection[0].add(tableviewrow0);
/* tableview */
var tbv = Ti.UI.createTableView({
data:mySection
});
win.add(tbv);
you need to continue for the next rows and sections. i didn't compiled it so be careful; it's just an idea. for android there are special preferences; look in the kitchensink .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.