自定义Tableview幻灯片操作

时间:2019-11-14 12:09:15

标签: ios swift tableview

如何在tableView单元格上创建自定义幻灯片操作,如下所示(此处的视频:https://imgur.com/a/dLYLuXe)。我特别不确定它们创建的包含滑动动作的舍入视图。任何信息/专业知识将非常有帮助!谢谢!

enter image description here

1 个答案:

答案 0 :(得分:0)

根据您的要求进行更改:

override func tableView(_ tableView: UITableView, editActionsForRowAt: IndexPath) -> [UITableViewRowAction]? {
    let share = UITableViewRowAction(style: .normal, title: "Share") { action, index in
        print("share button tapped")
    }
    share.backgroundColor = .blue

    return [share]
}

对于具有圆角的单元格,请使用此:

tableView.containerView.layer.cornerRadius = 10
tableView.containerView.layer.masksToBounds = true