Доля остановки анимации ячейки должна быть больше доли начала

Я использую анимацию в ячейке табличного представления... Анимация работает нормально, когда ячейка полностью видна. Если какая-либо ячейка частично видна в это время из-за анимации, мое приложение аварийно завершает работу в строке [_Mytableviewobject endUpdates];

Журнал сбоев = Завершение приложения из-за необработанного исключения «NSInternalInconsistencyException», причина :«Доля остановки анимации ячейки должна быть больше, чем доля запуска»

раздел кода:

-(void)sectionHeaderView:(SectionHeaderView*)sectionHeaderView sectionOpened:(NSInteger)sectionOpened
{
     //ENSLog(self, _cmd);
    [_caseTable reloadData];
    NSInteger countOfRowsToInsert = 1;
    SectionInfo *sectionInfo = [self.sectionInfoArray objectAtIndex:sectionOpened];
    sectionInfo.open = YES;


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

    NSMutableArray *indexPathsToDelete = [[[NSMutableArray alloc] init] autorelease];
    NSInteger previousOpenSectionIndex = self.openSectionIndex;
    if (previousOpenSectionIndex != NSNotFound)
    {
        SectionInfo *previousOpenSection = [self.sectionInfoArray objectAtIndex:previousOpenSectionIndex];
        previousOpenSection.open = NO;
        [previousOpenSection.headerView toggleOpenWithUserAction:NO];
        NSInteger countOfRowsToDelete = 1;
        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 = UITableViewRowAnimationTop;
        deleteAnimation = UITableViewRowAnimationTop;
    }

    // Apply the updates.
    [_caseTable beginUpdates];
    [_caseTable deleteRowsAtIndexPaths:indexPathsToDelete withRowAnimation:deleteAnimation];
    [_caseTable insertRowsAtIndexPaths:indexPathsToInsert withRowAnimation:insertAnimation];
    [_caseTable endUpdates];
    //ExNSLog(self, _cmd);

    self.openSectionIndex = sectionOpened;
    //ExNSLog(self, _cmd);

}




-(void)sectionHeaderView:(SectionHeaderView*)sectionHeaderView sectionClosed:(NSInteger)sectionClosed
{
     //ENSLog(self, _cmd);
    SectionInfo *sectionInfo = [self.sectionInfoArray objectAtIndex:sectionClosed];
    sectionInfo.open = NO;
    NSInteger countOfRowsToDelete = [_caseTable numberOfRowsInSection:sectionClosed];
    if (countOfRowsToDelete > 0)
    {
        NSMutableArray *indexPathsToDelete = [[[NSMutableArray alloc] init] autorelease];
        for (NSInteger i = 0; i < countOfRowsToDelete; i++) 
        {
            [indexPathsToDelete addObject:[NSIndexPath indexPathForRow:i inSection:sectionClosed]];
        }
        [_caseTable deleteRowsAtIndexPaths:indexPathsToDelete withRowAnimation:UITableViewRowAnimationTop];
    }
    self.openSectionIndex = NSNotFound;
     //ExNSLog(self, _cmd);
}
31
задан Shahnawaz Adil 26 July 2012 в 07:53
поделиться