I just made an implementation for SWIFT 3 on iOS 9.3+ and all i done was:
1. Place the image view inside a scrollview
2. Connect the scrollview delegate to collectionview cell class
3. Implement the code below on the collectionview subclass
class FullScreenImageTextDetailCollectionViewCell: UICollectionViewCell, UIScrollViewDelegate {
@IBOutlet var scrollview: UIScrollView!
@IBOutlet weak var backgroundImageView: UIImageView!
override func awakeFromNib() {
self.scrollview.minimumZoomScale = 0.5
self.scrollview.maximumZoomScale = 3.5
self.scrollview.delegate = self
}
func viewForZooming(in scrollView: UIScrollView) -> UIView? {
return self.backgroundImageView
}
}
No gesture recognizer adding or removing on the parent collectionview controller was necessary, worked like a charm!
Thanks for previous examples for reaching this!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…