diff --git a/SKPhotoBrowser/SKZoomingScrollView.swift b/SKPhotoBrowser/SKZoomingScrollView.swift index 883479b..3a25ea5 100644 --- a/SKPhotoBrowser/SKZoomingScrollView.swift +++ b/SKPhotoBrowser/SKZoomingScrollView.swift @@ -121,15 +121,31 @@ public class SKZoomingScrollView: UIScrollView, UIScrollViewDelegate, SKDetectin let deviceScreenWidth = UIScreen.mainScreen().bounds.width let deviceScreenHeight = UIScreen.mainScreen().bounds.height + let scale = UIScreen.mainScreen().scale - if photoImageView.frame.width < deviceScreenWidth { +// if photoImageView.frame.width < deviceScreenWidth { +// // I think that we should to get coefficient between device screen width and image width and assign it to maxScale. I made two mode that we will get the same result for different device orientations. +// if UIApplication.sharedApplication().statusBarOrientation.isPortrait { +// maxScale = deviceScreenHeight / photoImageView.frame.width +// } else { +// maxScale = deviceScreenWidth / photoImageView.frame.width +// } +// } else if photoImageView.frame.width > deviceScreenWidth { +// maxScale = 1.0 +// } else { +// // here if photoImageView.frame.width == deviceScreenWidth +// maxScale = 2.5 +// } + if photoImageView.frame.width < deviceScreenWidth * scale { // I think that we should to get coefficient between device screen width and image width and assign it to maxScale. I made two mode that we will get the same result for different device orientations. if UIApplication.sharedApplication().statusBarOrientation.isPortrait { - maxScale = deviceScreenHeight / photoImageView.frame.width + print("first photoImageView.frame.width < deviceScreenHeight", deviceScreenHeight * scale / photoImageView.frame.width) + maxScale = deviceScreenHeight * scale / photoImageView.frame.width } else { - maxScale = deviceScreenWidth / photoImageView.frame.width + print("second photoImageView.frame.width < deviceScreenWidth", (deviceScreenWidth * scale) / photoImageView.frame.width) + maxScale = deviceScreenWidth * scale / photoImageView.frame.width } - } else if photoImageView.frame.width > deviceScreenWidth { + } else if photoImageView.frame.width > deviceScreenWidth * scale { maxScale = 1.0 } else { // here if photoImageView.frame.width == deviceScreenWidth