You can zoom imageview like,
self.scrollView.minimumZoomScale = 0.2;
self.scrollView.maximumZoomScale = 5.0;
self.scrollView.delegate = self;
and you need to implement scrollview delegate
like,
-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
return self.imgView;
}
You should have scrollview
contains imageview
in your interface builder or say your view controller.
You need to confirm UIScrollViewDelegate
!
then you can zoom in or zoom out in your image view!
Swift :
self.scrollView.minimumZoomScale = 0.2
self.scrollView.maximumZoomScale = 5.0
self.scrollView.delegate = self
and
func viewForZooming(in scrollView: UIScrollView) -> UIView? {
return self.imgView
}
You can use this library which saves lot of time.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.