Does anyone know a way to temporarily turn off zooming when using a UIScrollView?
I see that you can disable scrolling using the following:
self.scrollView.scrollEnabled = false;
but I'm not seeing a similar command for zooming. Any thoughts?
Does anyone know a way to temporarily turn off zooming when using a UIScrollView?
I see that you can disable scrolling using the following:
self.scrollView.scrollEnabled = false;
but I'm not seeing a similar command for zooming. Any thoughts?
If you want to disable the user's ability to zoom through gestures then in iOS 5 and above you can disable the pinch gesture. This still allows you to control the scroll view from code...
similarly for pan...
This must be called in
- (void)viewDidAppear:(BOOL)animated
or later as otherwise the system resets it to enabled.Swift 3 Version:
Note that
doubleTapGestureRecognizer
should be an instance variable. It should be similar to:I have tried setting
minimumZoomScale
andmaximumZoomScale
properties ofUIScrollView
to1
orisMultipleTouchEnabled
property ofUIView
tofalse
or returnnil
fromviewForZooming(in:)
ofUIScrollViewDelegate
but none worked. In my case, after several trial and error, the following works in my case [Tested on iOS 10.3]: