小编Joh*_*nty的帖子

无需触摸即可轻扫UITableViewCell

正如我的标题所说,我希望UITableView在用户出现时从左到右滑动第一行ViewController.

在我的ViewController一个UITableView,每行有两个按钮"更多"和"删除"动作.看下面的代码

func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
    return true
}

func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
    if (editingStyle == UITableViewCellEditingStyle.delete) {
    }
}


func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
    let deleteButton = UITableViewRowAction(style: .normal, title: "Delete") { action, index in
        // Edit Button Action
    }
    deleteButton.backgroundColor = UIColor.red

    let editButton = UITableViewRowAction(style: .normal, title: "Edit") { action, index …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch uitableview swipe ios swift

16
推荐指数
1
解决办法
1017
查看次数

标签 统计

cocoa-touch ×1

ios ×1

swift ×1

swipe ×1

uitableview ×1