Pinch to zoom for the entire UICollectionView

I want my whole UICollectionView to scale, including all the elements in it.

I tried the delegate method func viewForZooming(in scrollView: UIScrollView) -> UIView? because the UICollectionView falls under the UIScrollView hierarchy. Unfortunately, this method does not start for the collection.

then I tried to put my collection view in UIScrollView ---> contentView (UIView).

 func viewForZooming(in scrollView: UIScrollView) -> UIView? { return self.contentView //The content view holds the collection } 

Note. UICollectionView is a content routine of UIScrollView contentView. UIScrollView maximumZoomScale has been set to 3.0. This is now scaling, but it does not work as excluded. After scaling the contents, the contents of the collection view do not scroll properly in the enlarged state.

Any help would be greatly appreciated.

+6
source share

All Articles