简体   繁体   English

删除部分时,UICollectionView崩溃

[英]UICollectionView crashes when deleting section

When using this code 使用此代码时

  - (void)actionSheet:(UIActionSheet *)actionSheet 
             clickedButtonAtIndex:(NSInteger)buttonIndex
    {
        if (buttonIndex == 0) {

            [self removeCompany:companySelectedInActionSheet]; 

            NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:
                          indexPathSelectedInActionSheet.section];
            NSLog(@"IndexSet to delete from collection view: %@",indexSet);
            [self.collectionView deleteSections:indexSet]; 
        }
    }

my app crashes sometimes (10% of the time) with this error: 我的应用有时会崩溃(10%的时间),并出现以下错误:

*** Assertion failure in -[UICollectionView _endItemAnimations], /SourceCache/UIKit_Sim/UIKit-2903.2/UICollectionView.m:3700

Any thoughts on what might be wrong? 有什么想法可能有问题吗?

Is the action sheet, which is presented before the deletion, a potential problem? 删除之前提供的操作表是否可能存在问题?

Do I need to dismiss it manually before deleting the collection view section? 在删除“收藏夹视图”部分之前,是否需要手动将其关闭?

viewDidDisappear上将表视图委托设置为nil

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM