Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Unified Diff: ios/chrome/browser/ui/collection_view/collection_view_controller.mm

Issue 2738743005: Add a way to reconfigure cell from IndexPaths (Closed)
Patch Set: Add a comment Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698