1

セクションのセルの行を展開するコードのスニペットがあります。xtable の更新時にエラーが発生します [ UIViewAnimation initWithView:indexPath:endRect:endAlpha:startFraction:endFraction:curve:animateFromCurrentPosition:shouldDeleteAfterAnimation:editing:]

コードのスニペット

  -(void)sectionHeaderView:(SectionHeaderView*)sectionHeaderView sectionOpened:(NSInteger)sectionOpened {


SectionInfo *sectionInfo = [self.sectionInfoArray objectAtIndex:sectionOpened];

sectionInfo.open = YES;



    NSInteger countOfRowsToInsert = 5;         
NSMutableArray *indexPathsToInsert = [[NSMutableArray alloc] init];
for (NSInteger i = 0; i < countOfRowsToInsert; i++) {
    [indexPathsToInsert addObject:[NSIndexPath indexPathForRow:i inSection:sectionOpened]];
}


NSMutableArray *indexPathsToDelete = [[NSMutableArray alloc] init];

NSInteger previousOpenSectionIndex = self.openSectionIndex;
if (previousOpenSectionIndex != NSNotFound) {

    SectionInfo *previousOpenSection = [self.sectionInfoArray objectAtIndex:previousOpenSectionIndex];
    previousOpenSection.open = NO;
    [previousOpenSection.headerView toggleOpenWithUserAction:NO];
    NSInteger countOfRowsToDelete = 5;    

    for (NSInteger i = 0; i < countOfRowsToDelete; i++) {
        [indexPathsToDelete addObject:[NSIndexPath indexPathForRow:i inSection:previousOpenSectionIndex]];
    }
}

// Style the animation so that there's a smooth flow in either direction.
UITableViewRowAnimation insertAnimation;
UITableViewRowAnimation deleteAnimation;
if (previousOpenSectionIndex == NSNotFound || sectionOpened < previousOpenSectionIndex) {
    insertAnimation = UITableViewRowAnimationTop;
    deleteAnimation =UITableViewRowAnimationBottom;
}
else {
    insertAnimation = UITableViewRowAnimationBottom;
    deleteAnimation = UITableViewRowAnimationTop;
}

// Apply the updates.
[xtable beginUpdates];
[xtable insertRowsAtIndexPaths:indexPathsToInsert withRowAnimation:insertAnimation];


 [xtable deleteRowsAtIndexPaths:indexPathsToDelete withRowAnimation:deleteAnimation];
[xtable  endUpdates];
self.openSectionIndex = sectionOpened;

}

何が間違っている可能性がありますか?何か案は?

4

1 に答える 1