imzyf / ios-swift-learning-notes

📝 iOS Swift Learning Notes - see Issues
MIT License
0 stars 0 forks source link

editActionsForRowAt TableViewCell 侧滑 #48

Closed imzyf closed 6 years ago

imzyf commented 6 years ago
    func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
        let deleteAction = UITableViewRowAction(style: .default, title: "Delete") { (action, index) in
            debugPrint("\(index.row)-Delete")
        }
        deleteAction.backgroundColor = UIColor.red

        let moreAction = UITableViewRowAction(style: .normal, title: "👍") { (action, index) in
            debugPrint("\(index.row)-More")
        }
        moreAction.backgroundColor = UIColor.lightGray

        return [deleteAction, moreAction]
    }
imzyf commented 6 years ago

合并