Ios TVanimationSpirates可重用错误:

Ios TVanimationSpirates可重用错误:,ios,iphone,objective-c,uitableview,insert-update,Ios,Iphone,Objective C,Uitableview,Insert Update,我使用的样本模板从苹果可以找到。当只有三个部分时,它工作得非常好。但是如果我将节数乘以5,你从最底部的单元格打开节。然后向上滚动,然后向下滚动,您会看到单元格被重新使用,当您点击打开的单元格的节标题时,单元格认为它处于关闭状态,从而导致崩溃 有人遇到过同样的问题吗?有人有相同的解决方案吗 提前感谢。示例项目中有一个细微的错误。示例代码没有说明APLSectionHeaderView对象是否被其他部分重用 添加行 sectionHeaderView.disclosureButton.selecte

我使用的样本模板从苹果可以找到。当只有三个部分时,它工作得非常好。但是如果我将节数乘以5,你从最底部的单元格打开节。然后向上滚动,然后向下滚动,您会看到单元格被重新使用,当您点击打开的单元格的节标题时,单元格认为它处于关闭状态,从而导致崩溃

有人遇到过同样的问题吗?有人有相同的解决方案吗


提前感谢。

示例项目中有一个细微的错误。示例代码没有说明APLSectionHeaderView对象是否被其他部分重用

添加行

sectionHeaderView.disclosureButton.selected = (section==self.openSectionIndex)?YES:NO;
就在从方法返回之前

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
- (void)sectionHeaderView:(APLSectionHeaderView *)sectionHeaderView sectionOpened:(NSInteger)sectionOpened 
改变这个

        APLSectionInfo *previousOpenSection = (self.sectionInfoArray)[previousOpenSectionIndex];
        previousOpenSection.open = NO;
        [previousOpenSection.headerView toggleOpenWithUserAction:NO];
对此

        APLSectionInfo *previousOpenSection = (self.sectionInfoArray)[previousOpenSectionIndex];
        previousOpenSection.open = NO;
        if (previousOpenSection.headerView.section  == previousOpenSectionIndex) {
            [previousOpenSection.headerView toggleOpenWithUserAction:NO];
        }
在方法中

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
- (void)sectionHeaderView:(APLSectionHeaderView *)sectionHeaderView sectionOpened:(NSInteger)sectionOpened