1

I'm trying to change the dataSource (NSFetchedResultsController) of a collectionView on the fly. I have a var currentFetchesResultsController which I can change. After that I call reloadData on the collectionView. So far so good, but the cells are not animated...

I also tried:

[self.collectionView performBatchUpdates:^{
    [self.collectionView reloadData];
} completion:^(BOOL finished) {}];

then I get the following error:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of sections.  The number of sections contained in the collection view after the update (4) must be equal to the number of sections contained in the collection view before the update (1), plus or minus the number of sections inserted or deleted (0 inserted, 0 deleted).' 

What's the best way to solve this?

Thanks in advance for your help.

4

1 回答 1

0

这里讨论了如何使用更新的(不是新的)数据源更新 uicollectionview 而不会出现 NSInternalInconsistencyException。希望能帮助到你。

于 2013-07-31T09:44:52.990 回答