Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make UICollectionView zoomable?

Is there any method make the UICollectionView zoomable, i.e. when you pinch, all the cells can be zoomed in and out.
I can implement this in UIScrollView by returning the only subview of the UIScrollView from delegate method

- (UIView*)viewForZoomingInScrollView:(UIScrollView *)scrollView

Since UICollectionView is kind of UIScrollView, is there a way or work around to implement this? Does the UICollectionView has one direct subview that contains all cells?
Thanks

like image 333
yibuyiqu Avatar asked Nov 21 '12 02:11

yibuyiqu


1 Answers

I think what you're asking for looks like what is done in the WWDC1012 video entitled Advanced Collection Views and Building Custom Layouts (demo starts at 20:20).

You basically have to add pinchGesture to you UICollectionView, then pass the pinch properties (scale, center) to the UICollectionViewLayout (which is a subclass of UICollectionViewFlowLayout), your layout will then perform the transformations needed to zoom on the desired cell.

like image 71
vitaminwater Avatar answered Oct 23 '22 16:10

vitaminwater