Pinch to zoom
With this tech note we'll see how to add the pinch to zoom support to image views. ImageViews don’t support any type of zooming, so we'll use a scrollable View to make any ImageView support pinch to zoom.
First, drop a View (
Window1, then drop an ImageView (
View1. Set the same size to
Add an image to the
ImageView1 and set the resize mode property to
Zooming is enabled if you returns a valid view in the
ViewForZooming event of the enclosing View and if its
maximumZoomScale property is greater than the minimumZoomScale (the default value for both properties is 1.0).
So, just add the following code to
self.maximumZoomScale = 10.0
- Optional: if you need to be notified of changes in the
zoomScaleproperty, just use the
Note: The pinch to zoom feature is not currently supported in Creo Simulator but it works in iOS devices and in Apple iOS simulators.
- PinchToZoom.creoproject (1.2MB)