[After scrolling : Problem White Screen]1
[Before Zoom image setted aspect ratio]
I am implementing a photo view page, which includes just a photo. Functionalities : Zoom.
As the image is of size 1024x510. I have implemented aspect ratio and set the imageview frame to the screensize. I have implemented using Scrollview and imageview concept.
The problem is that, when I zoom the image white screen is also zoomed. Problem is the white space os imageview while zooming. . Code
override func viewDidLoad() {
super.viewDidLoad()
print(imageIndex)
self.scrollV.maximumZoomScale = 5.0
self.scrollV.minimumZoomScale = 1.0
self.scrollV.contentSize = self.view.bounds.size;
self.scrollV.delegate = self
let urlStr : NSString = vehicleImages[imageIndex].stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)!
url=NSURL(string: urlStr as String)
imageView.kf_setImageWithURL(url,placeholderImage: UIImage(named: "placeholder.png"))
}
func viewForZoomingInScrollView(scrollView: UIScrollView) -> UIView? {
return imageView
}
Take a look at these methods. May be it will help. I have scroll view stretched to controller's view size.
customizeScrollView()
will calculate min and max scale options.centerImageView()
will put UIImageView in the center of your UIScrollViewAlso UIScrollViewDelegate methods: