swift tableview 侧滑删除

//返回编辑类型,滑动删除rem

    func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {it

        return UITableViewCellEditingStyle.Deleteio

    }table

    

    //在这里修改删除按钮的文字List

    func tableView(tableView: UITableView, titleForDeleteConfirmationButtonForRowAtIndexPath indexPath: NSIndexPath) -> String? {方法

        return "点击删除"im

    }tab

    

    //点击删除按钮的响应方法,在这里处理删除的逻辑di

    func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {co

        if editingStyle == UITableViewCellEditingStyle.Delete {

            

                        self.dataList!.removeAtIndex(indexPath.row)

                        self.tableView!.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade)

        }

    }

相关文章
相关标签/搜索