簡體   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