iOS 8以后滑动cell删除等菜单

- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewRowAction *row1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:NSLocalizedString(@"编辑", nil) handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
        NSLog(@"%ld的编辑",(long)indexPath.row);
    }];
    row1.backgroundColor = [UIColor orangeColor];
    
    UITableViewRowAction *row2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:NSLocalizedString(@"删除了", nil) handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
        NSLog(@"%ld的删除",(long)indexPath.row);
    }];
    row2.backgroundColor = [UIColor blueColor];
    
    return @[row1,row2];
}

你可能感兴趣的:(iOS 8以后滑动cell删除等菜单)