Reputation: 718
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
Upvotes: 13
Views: 14754
Reputation: 6944
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.
Upvotes: 16