如何使用Titanium Appcelerator在应用程序中创建一个复选框首选项区域

How to create a checkbox preferences area in your app using Titanium Appcelerator?

本文关键字:一个 复选框 区域 首选项 创建 Titanium 何使用 Appcelerator 应用程序      更新时间:2023-09-26

我正在使用Titanium Appcelerator,我一直在试图弄清楚如何在我的应用程序中创建一个部分,用户可以通过检查一些复选框来存储那里的设置。

iPhone还是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);

,接下来的行和部分需要继续。我没有编译它,所以要小心;这只是一个想法。android有一些特殊的偏好;看厨房水槽