new algorithm for maxScale in SKZoomingScrollView

This commit is contained in:
Alexsandersky 2016-03-02 11:22:23 +04:00
parent 93b90d5ebe
commit b007e9b5af
1 changed files with 14 additions and 1 deletions

View File

@ -113,7 +113,20 @@ public class SKZoomingScrollView: UIScrollView, UIScrollViewDelegate, SKDetectin
let xScale = boundsSize.width / imageSize.width
let yScale = boundsSize.height / imageSize.height
let minScale: CGFloat = min(xScale, yScale)
var maxScale: CGFloat = 1.0
var maxScale: CGFloat!
let deviceScreenWidth = UIScreen.mainScreen().bounds.width
if photoImageView.frame.width < deviceScreenWidth {
if deviceScreenWidth / 2 > photoImageView.frame.width {
maxScale = 3.0
} else {
maxScale = 2.0
}
} else {
maxScale = 1.0
}
maximumZoomScale = maxScale
minimumZoomScale = minScale