【问题标题】:Keep TableViewRow selected in Appcelerator Titanium在 Appcelerator Titanium 中保持选中 TableViewRow
【发布时间】:2012-06-18 12:35:03
【问题描述】:

我正在 Titanium 中开发一个简单的产品目录,并且我有一个包含产品列表的 TableView 和一个用于查看所选产品的产品详细信息视图。我想要做的是在 TableView 中明显选择所选产品。

Titanium 默认使用动画取消选择行,因此无论何时选择一行,选择颜色都会淡出。

这就是我的应用现在的样子:

这就是我想要的样子:

有什么想法吗?

【问题讨论】:

    标签: ios titanium


    【解决方案1】:

    试试这个:

    // Create table view data object
    var data = [
        {title:'Row 1', hasChild:true, color:'red', selectedColor:'#fff'},
        {title:'Row 2', hasDetail:true, color:'green', selectedColor:'#fff'},
        {title:'Row 3', hasCheck:true, color:'blue', selectedColor:'#fff'},
        {title:'Row 4', color:'orange', selectedColor:'#fff'}
    ];
    
    // Create table view and set allowSelection to true
    var tableview = Titanium.UI.createTableView({
        data:data,
        allowsSelection:true  // This should do the trick
    });
    
    // Select the 4th row
    tableview.selectRow(3);
    
    // Add table view to the current window
    Titanium.UI.currentWindow.add(tableview);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-03
      • 2014-07-15
      • 1970-01-01
      • 2012-09-13
      相关资源
      最近更新 更多