ios8 新特性 UITableViewRowAction

// 原滑动删除方法,需保留
    override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
        
    }
    
    // 滑动删除与编辑
    override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {
        
        var editAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "编辑") {
            (action: UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in
            
           // 编辑的业务逻辑


        }
        
        var deleteAction = UITableViewRowAction(style: UITableViewRowActionStyle.Normal, title: "删除") {
            (action: UITableViewRowAction!,indexPath: NSIndexPath!) -> Void in
            
           // 删除的业务逻辑


        }
        
        // 设置背景颜色
        editAction.backgroundColor = UIColor.lightGrayColor()
        deleteAction.backgroundColor = UIColor.redColor()
        return [deleteAction, editAction]
    }

 
原文地址:https://www.cnblogs.com/lisen-lisen/p/4826142.html