ListView滑动以删除

时间:2018-12-28 00:07:19

标签: nativescript

是否可以在NativeScript的ListView中实现该目标?
RadListView具有内置的此机制,但是ListView对于我的布局具有更好的性能。
我一直在搜索documentation,但似乎没有,所以我在原生元素中寻找一种方法:iOS的UITableView和Android的ListView-
对于UITableView,我发现this博客文章建议:

  

只需要一种方法就可以在表格视图中滑动以删除:   tableView(_:commit:forRowAt:)

那么如何将其翻译为NativeScript?
帖子中的快捷代码是:

override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
    if editingStyle == .delete {
        objects.remove(at: indexPath.row)
        tableView.deleteRows(at: [indexPath], with: .fade)
    } else if editingStyle == .insert {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
    }
}

还有,在Android的ListView中有直接的方法吗?

0 个答案:

没有答案