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
import UIKit | |
// known-good: Xcode 8.2.1 | |
/** | |
UIImageView subclass which works with Auto Layout to try | |
to maintain the same aspect ratio as the image it displays. | |
This is unlike the usual behavior of UIImageView, where the | |
scaleAspectFit content mode only affects what the view displays |