ios - Error when performing batch update on UICollectionView -
I get this error every time I reload UICollectionview and I do not think this is an error indicator because the archive view should not be updated before this call
- (zero) load Gallery: (Zero (^) ()) Completed ({self indeminateAssetsWithCompletion: ^ (BOOL breakthrough, NSMutableArray * property) {if (success) {self.photos = [property volatile coop]; @ attempt {[self.collectionView PerformBatchUpdates: ^ {[self.collectionView reloaddata];} Closing: ^ (BOOL Finish) {complete ();}};} @chitch (NSE exp Exceptions) {} {} "}}};} - (zero) enumerate assets termination: (zero (^) (Bell's success, NSMUtABEL * Assets) * Lock complete {ALSATS Library * al = [[Self-class] Shared library; __block NSMutableArray * mutableAssets = [NSMutableArray new]; [Al-Enumerate Groups Waste Type: Use the Elassette Group L.Loc: ^ (ALSATT Group * Group, Ball * stop) {if (Group == Sh NY) {//self.groups = [Mutiv Group Copy]; If (period) {full ball (yes, mutuishet); }} And {{Group Set Assets Filler: [All Photos All Photos]]; [Group Enumerate Asset Block: ^ (ALSSset * result, NSUntengar index, BOL * stop) {if (result) {[MUSICASESET adobject: result]; }}]; }} FailureBlock: ^ (NSError * error) {ELog (@ "Failed to calculate clusters. Error:% @.", Error); Block (no, zero) to complete if (perfection block); }]; } Error:
Dubai: failure to update batch Invalid update: Invalid number of items in section 1. After update (352), the number of items present in an existing section should be equal to the number of items in that section before the update (0), plus or less number removed from that segment (0 entered, 0 removed) Or the number of items transferred to that section from plus or minus of removed items (moved in 0, moved to 0). In the batch update block, you must insert, delete, reload, or move the cells.
Just look at the archive within the batch update block Reloading is incorrect because you are not including anything, and after updating batch, the new calculation of storage view items is higher than before. > Therefore, you should reload your collection view without batch updating or insert 352 items inside the block.
NSIndexSet * indexSet = [NSIndexSet indexSetWithIndexesInRange: NSMakeRange (0, self.photos.count)]; [Self.collectionView performBatchUpdates: ^ {{indexSet enumerateIndexesUsingBlock: ^ (NSUInteger idx, bool * stop) {[self.collectionView insertItemsAtIndexPaths: @ [[NSIndexPath indexFFITIM: Address in IDX: 0]]]; }]; } Closing: ^ (BOOL Finish) {Full (); }]; But, if you reload your collection view more than once, then you will get a lot of pain with it.
Comments
Post a Comment