views:

428

answers:

2

Is there an "accepted" way of performing (pinch) zoom on a view that is not based on UIScrollView?

+1  A: 

There's a code sample by Erica Sadun that does the math for treating touch events as scale/rotate/translate transforms that you can probably borrow from. Basically, it sounds like you want to apply a scaling affine transform. This code doesn't include the niceties of "bouncing" the view when you reach the edges of the content, so you'll have to do that yourself.

Full disclosure: I haven't done this in almost a year. It's likely that there are frameworks now that include much more straightforward support for this feature.

warrenm
Your link requires basic auth. :-(
Jonny
The code I was referring to has since been relocated to github: http://github.com/erica/iphone-3.0-cookbook-/blob/master/C08-Gestures/14-Resize%20And%20Rotate/main.m Hope that helps.
warrenm
A: 

If you are working in iPhone OS 3.2 (for the iPad) or iOS 4 for the iPhone 4, you can use the UIPinchGestureRecognizer class to detect pinch gestures.

rekle