繁体   English   中英

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

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

我正在使用 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 有特殊偏好; 看看厨房水槽

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM