tableview 删除row ,删除组

[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];数组

删除行动画

-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath索引

{rem

    if (editingStyle==UITableViewCellEditingStyleDelete) {it

        //        获取选中删除行索引值io

        NSInteger row = [indexPath row];table

        //        经过获取的索引值删除数组中的值im

        [self.arrayimg removeObjectAtIndex:row];img

        //        删除单元格的某一行时,在用动画效果实现删除过程tab

       [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];

  

    }

}

 

-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath

{

    return UITableViewCellEditingStyleDelete;

}

 

 

[tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationAutomatic];

删除组

-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath

{

    if (editingStyle==UITableViewCellEditingStyleDelete) {

        //        获取选中删除行索引值

//        NSInteger row = [indexPath row];

        //        经过获取的索引值删除数组中的值

        NSInteger section = [indexPath section];

        [self.arrayimg removeObjectAtIndex:section];

        //        删除单元格的某一组时,在用动画效果实现删除过程

        //[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];

        [tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationAutomatic];

    }

}

 

-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath

{

    return UITableViewCellEditingStyleDelete;

}

相关文章
相关标签/搜索