Search code examples
ios5uiscrollviewuiscrollviewdelegate

UIScrollView. How Can I Tell Zoom Out From Zoom In?


On iOS I have a UIScrollView subclass. During a zoom gesture I need to distinguish zoom-out from zoom-in. What is the best way to do this?

Thanks,
Doug


Solution

  • In UIScrollViewDelegate's scrollViewWillBeginZooming:withView:, store the current zoomScale of your UIScrollView; compare the stored value to the zoomScale in the scrollViewDidEndZooming:withView:atScale: to determine if it was a zoom in or a zoom out. If the value has increased, it was a zoom in; otherwise, it was a zoom out.