Index: ios/chrome/browser/ui/collection_view/collection_view_controller.mm |
diff --git a/ios/chrome/browser/ui/collection_view/collection_view_controller.mm b/ios/chrome/browser/ui/collection_view/collection_view_controller.mm |
index 3914205819c4c2e2e8292078ee5f2d8bd9978e74..050eb0ee2a206aac102d4cc3afb2096b5fcac132 100644 |
--- a/ios/chrome/browser/ui/collection_view/collection_view_controller.mm |
+++ b/ios/chrome/browser/ui/collection_view/collection_view_controller.mm |
@@ -74,14 +74,15 @@ |
NSIndexPath* indexPath = |
[self.collectionViewModel indexPathForItem:item |
inSectionWithIdentifier:sectionIdentifier]; |
- MDCCollectionViewCell* cell = |
- base::mac::ObjCCastStrict<MDCCollectionViewCell>( |
- [self.collectionView cellForItemAtIndexPath:indexPath]); |
+ [self reconfigureCellAtIndexPath:indexPath withItem:item]; |
+ } |
+} |
- // |cell| may be nil if the row is not currently on screen. |
- if (cell) { |
- [item configureCell:cell]; |
- } |
+- (void)reconfigureCellsAtIndexPaths:(NSArray*)indexPaths { |
+ for (NSIndexPath* indexPath in indexPaths) { |
+ CollectionViewItem* item = |
+ [self.collectionViewModel itemAtIndexPath:indexPath]; |
+ [self reconfigureCellAtIndexPath:indexPath withItem:item]; |
} |
} |
@@ -268,4 +269,19 @@ |
} |
} |
+#pragma mark - Private |
+ |
+// Reconfigures the cell at |indexPath| by calling |configureCell:| with |item|. |
+- (void)reconfigureCellAtIndexPath:(NSIndexPath*)indexPath |
+ withItem:(CollectionViewItem*)item { |
+ MDCCollectionViewCell* cell = |
+ base::mac::ObjCCastStrict<MDCCollectionViewCell>( |
+ [self.collectionView cellForItemAtIndexPath:indexPath]); |
+ |
+ // |cell| may be nil if the row is not currently on screen. |
+ if (cell) { |
+ [item configureCell:cell]; |
+ } |
+} |
+ |
@end |