ios tableview 插入删除

来源:互联网 发布:装了linux系统无法打开 编辑:程序博客网 时间:2024/06/06 02:01

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


    returnUITableViewCellEditingStyleDelete;

}



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


 [arryremoveObjectAtIndex:indexPath.row];

    [tableView deleteRowsAtIndexPaths:[NSArrayarrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft];


    

}


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{


    [arryaddObject:@"100"];

    NSIndexPath *index =[NSIndexPathindexPathForRow:arry.count-1inSection:0];

    

    [tableView insertRowsAtIndexPaths:[NSArrayarrayWithObject:[NSIndexPathindexPathForRow:arry.count-1inSection:0]]withRowAnimation:UITableViewRowAnimationFade];


}

0 0
原创粉丝点击