gpt4 book ai didi

ios5 - 单元动画停止分数必须大于开始分数

转载 作者:行者123 更新时间:2023-12-03 08:50:39 26 4
gpt4 key购买 nike

我在表格 View 单元格中使用动画...当单元格完全可见时,动画工作正常。如果当时由于动画而部分单元格可见,则我的应用程序在[_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);
}

最佳答案

是的,我也遇到这种类型的问题,只删除页脚 View 就可以做一件事。

关于ios5 - 单元动画停止分数必须大于开始分数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11664766/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com