new algorithm
This commit is contained in:
parent
e5b2be2b44
commit
f317f60119
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue