Ios UITableView动画故障

Ios UITableView动画故障,ios,iphone,uitableview,animation,Ios,Iphone,Uitableview,Animation,当我用动画重新加载两个单元格时,在其他一些未设置动画的单元格之间会出现一个空格。然而,最有趣的是,它有时发生,有时不发生。以下代码来自tableView委托的didselect函数 NSArray *taskArray; int count ; if (array.count >= indexPath.row+1) { taskArray = [[dictionary objectForKey:[NSString stringWithFormat:@"We

当我用动画重新加载两个单元格时,在其他一些未设置动画的单元格之间会出现一个空格。然而,最有趣的是,它有时发生,有时不发生。以下代码来自tableView委托的didselect函数

 NSArray *taskArray;
    int count ;
    if (array.count >= indexPath.row+1) {
        taskArray = [[dictionary objectForKey:[NSString stringWithFormat:@"Week %i",indexPath.section+1]] objectForKey:[array objectAtIndex:indexPath.row]];
        count = [taskArray count];
    }else{

        count = 0;

    }
    numberOfAddedRows = count;

    selectedRow = -1;
    selectedSection = -1;


    int numberOfRows = [[[dictionary objectForKey:[NSString stringWithFormat:@"Week %i",indexPath.section+1]] allKeys] count];

    [self.tableView beginUpdates];





    /*for (int i = numberOfRows-1+numberOfAddedRows; i > indexPath.row; i--) {
     [array addObject:[NSIndexPath indexPathForRow:i-1 inSection:indexPath.section]];
     }*/

    if (!editMode) {


       [array__ removeAllObjects];
        for (int i =  indexPath.row+numberOfAddedRows; indexPath.row < i; i--) {

            [array__ addObject:[NSIndexPath indexPathForRow:i inSection:indexPath.section]];
        }




        [self.tableView deleteRowsAtIndexPaths:array__ withRowAnimation:UITableViewRowAnimationMiddle];



    }else{

        [array__ removeAllObjects];
        for (int i =  indexPath.row+numberOfAddedRows+1; indexPath.row < i; i--) {
            [array__ addObject:[NSIndexPath indexPathForRow:i inSection:indexPath.section]];
        }


        UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];

        UITextField *textField = (UITextField*)[cell viewWithTag:2];
        [textField resignFirstResponder];




        [self.tableView deleteRowsAtIndexPaths:array__ withRowAnimation:UITableViewRowAnimationMiddle];



    }





    [self.tableView endUpdates];

     [self.tableView reloadData];
NSArray*任务阵列;
整数计数;
if(array.count>=indexPath.row+1){
taskArray=[[dictionary objectForKey:[NSString stringWithFormat:@“Week%i”,indexPath.section+1]]objectForKey:[array objectAtIndex:indexPath.row]];
计数=[taskArray计数];
}否则{
计数=0;
}
NumberOfAddDrows=计数;
selectedRow=-1;
selectedSection=-1;
int numberOfRows=[[dictionary objectForKey:[NSString stringWithFormat:@“Week%i”,indexath.section+1]]所有键]计数];
[self.tableView开始更新];
/*对于(int i=numberOfRows-1+numberOfAddedRows;i>indexPath.row;i--){
[array addObject:[NSIndexPath indexPathForRow:i-1片段:indexPath.section]];
}*/
如果(!编辑模式){
[array_uuu_uuuu移除所有对象];
for(int i=indexPath.row+numberOfAddDrows;indexPath.row
你为什么要写最后一行

 [self.tableView reloadData];

尝试删除它-我认为它会干扰动画。

删除[self.tableView reloadData];更新动画正在进行时,您正在重新加载所有单元格。。