单元格动画停止分数必须大于开始分数 [英] Cell animation stop fraction must be greater than start fraction

查看:9
本文介绍了单元格动画停止分数必须大于开始分数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在表格视图单元格中使用动画...当单元格完全可见时,动画工作正常.如果当时由于动画任何单元格部分可见,我的应用程序将在 [_Mytableviewobject endUpdates] 行崩溃;

I m using Animation in table view cell...Animation is working fine when cell is totally visible.if any cell is partially visible at that time due to Animation my app is getting crashed at the line [_Mytableviewobject endUpdates];

崩溃日志=由于未捕获的异常NSInternalInconsistencyException"而终止应用程序,原因:单元格动画停止部分必须大于开始部分"

Crash Log=Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cell animation stop fraction must be greater than start fraction'

代码部分:

-(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);
}

推荐答案

是的,我也面临这种类型的问题,做一件事只是删除页脚视图.

Yes i also face this type of problem,do one thing just remove footer view.

这篇关于单元格动画停止分数必须大于开始分数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆