2) create array of index paths
3) update your view
sample code:
NSArray* dataArray = // however you get the data if (dataArray.count == 0) { moreTaps = NO; return; } NSMutableArray* indexArray = @[].mutableCopy; NSInteger dataSourceCount = arrayDisplay.count; for (int i = 0; i < dataArray.count; i++) { if ([indexHolderArray containsObject:[[dataArray objectAtIndex:i] anId]]) { continue; } [arrayDisplay addObject:[dataArray objectAtIndex:i]]; NSInteger indexPathItem = i + dataSourceCount; [indexArray addObject:[NSIndexPath indexPathForRow:indexPathItem inSection:0]]; } dispatch_sync(dispatch_get_main_queue(), ^{ [_collectionView insertItemsAtIndexPaths:indexArray]; });
No comments:
Post a Comment