The point is that in your handRotate
method you are assigning a rotation transformation to your view. This entails a permanent (until you modify the transformation again) change in the way your view is displayed within its superview, and the rotation transformation will be always "added" to whatever other change you do to the geometrical properties of your view.
What explains the behavior you are seeing is the interplay between the position of your view and its anchor point, as explained in Layer Geometry and Transform.
In other words, the center
property you are modifying when panning is the result of applying all the transforms that you have defined for your view. On the other hand, what you are trying to do when panning would require modifying the position of the view before the transformation are applied.
A way to go about this is reframing your code by using layers (CALayer
) and modifying the layer position
property instead of the view center
. Like in:
recognizer.view.layer.position = ...
I think that this should fix it.
(You will need to import QuartzCore for that to compile).
Hope this helps.