You can simply use a different layout (similar to the one you already have), in which the item is larger, and then setCollectionViewLayout:animated:completion: in the collection.
You do not need a new view controller. Your data source remains the same. You can even use the same cell class, just make sure it knows when to compose things for the larger cell contents, and when not to.
I am absolutely sure that how Facebook does this in the document, since there is no reloading of content, i.e. [collectionView reloadData] will never be called (would cause the scroll offset to flicker and reset, etc.). This is apparently the most direct solution.
CGPoint pointInCollectionView = [gesture locationInView:self.collectionView]; NSIndexPath *selectedIndexPath = [self.collectionView indexPathForItemAtPoint:pointInCollectionView]; UICollectionViewCell *selectedCell = [self.collectionView cellForItemAtIndexPath:selectedIndexPath]; NSLog(@"Selected cell %@", selectedIndexPath); __weak typeof(self) weakSelf = self; [self.collectionView setCollectionViewLayout:newLayout animated:YES completion:^{ [weakSelf.collectionView scrollToItemAtIndexPath:selectedIndexPath atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:NO]; }];
source share