-(NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewRowAction *deleteRoWAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@" 删除" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {//title可自已定义
//这里面写button点击之后的事件
[self.dataArray removeObjectAtIndex:indexPath.row];//这里的dataArray是可变数组,滑动删除的时候,需要删除数组中的元素
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}];
deleteRoWAction.backgroundColor = [UIColor redColor];
UITableViewRowAction *test = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"设为已读" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {//title可自已定义
}];
test.backgroundColor = [UIColor grayColor];
return @[deleteRoWAction,test];//最后返回这俩个RowAction 的数组
}