This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@objc func handleDoubleTap(_ recognizer: UITapGestureRecognizer) { | |
let scale = min(scrollView.zoomScale * 2, scrollView.maximumZoomScale) | |
if scrollView.zoomScale == scrollView.minimumZoomScale { // zoom in | |
let point = recognizer.location(in: imageView) | |
let scrollSize = scrollView.frame.size | |
let zoomScale = scrollView.maximumZoomScale * 0.7 | |
let size = CGSize(width: scrollSize.width / zoomScale, | |
height: scrollSize.height / zoomScale) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@objc func handleDoubleTap(_ recognizer: UITapGestureRecognizer) { | |
let scale = min(scrollView.zoomScale * 2, scrollView.maximumZoomScale) | |
if scale != scrollView.zoomScale { // zoom in | |
let point = recognizer.location(in: imageView) | |
let scrollSize = scrollView.frame.size | |
let size = CGSize(width: scrollSize.width / scrollView.maximumZoomScale, | |
height: scrollSize.height / scrollView.maximumZoomScale) | |
let origin = CGPoint(x: point.x - size.width / 2, |