Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone/iPad Pan, Pinch and Rotate a view simultaneously

I'm trying to recreate the behaviour of the photos app, where you can pan, pinch and rotate simultaneously. I have the basics working, but I'm stuck on something.

For the pan, I offset the centrepoint of the view by the translation amount. This is working well.

For the pinch and rotate I'm applying an affine transform to the view. This is also working well.

The problem is when I pan (ie. move the subview), and then pinch or rotate - the affine transform seems to get applied using the old centre point of the view. I though that it should use the current centre point as the transform origin - as I'm updating the centrepoint when I pan I though that this should work. Instead of a rotation about the centrepoint of the subview, I get a rotational movement about the original centrepoint.

How do I correct this ? It's clearly possible to combine these three gestures intuitively, as the photos app does it successfully.

I tried using an affine translation for the pan, but the effect was the same.

like image 643
rennarda Avatar asked Nov 14 '22 10:11

rennarda


1 Answers

Apple have confirmed this appears to be a bug with the way that gesture recognisers are working in iPhone OS 3.2. I have filed a bug report.

like image 98
rennarda Avatar answered Dec 19 '22 13:12

rennarda