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?
Check setting
minimumZoomScale
andmaximumZoomScale
; According to the docs:So, setting the values to be the same should disable zooming.
I know this is a really old question but I made a slight variation for my purposes.
I wanted to be able to easily tell if the zooming was in fact enabled/disabled without relying on a comparison between
scrollView.minimumZoomScale == scrollView.maximumZoomScale
, which could possibly not reflect whether zooming was actually enabled/disabled.So I did this
The values for
self.minimumZoomScale
andself.maximumZoomScale
are set at the time theUIScrollView
is configured.This gives me the ability to set/ask if zooming is enabled.
here, my solution for stop zooming on scrollview.
Also you can return "nil" as zooming view in UIScrollViewDelegate:
Following fbrereto's advice above, I created two functions lockZoom and unlockZoom. When locking Zoom i copied my max and min zoom scales to variables then set the max and min zoom scale to 1.0. Unlocking zoom just reverses the process.
If you want to disable only zooming with pinch gesture, below code does the trick.