Why do I use "pan" after rotae pretends to be the opposite?

Why does using pan after a turn make it look the other way around?

It seems these two gestures use a different coordinate system? Is rotation used when it is rotated and the pan is normal?

And if the view is rotated about 0 'or 360', the panorama will be normal, and if the view is rotated more than colse to 180 ', then the "panorama" will make the view even more opposite.

Thanks.

enter image description here

+1
source share
1 answer

The point is, in your handRotate method handRotate you assign a rotation transformation to your view. This entails a constant (until you change the transformation again) change the way your view is displayed within your supervisor, and the rotation transformation will always be β€œadded” to any other changes that you make with the geometric properties of your view.

Which explains the behavior you see is the interaction between the position of your view and its anchor point, as described in Layer Geometry and Transform , in other words, the center property that you change when panning is the result of applying all the transformations that you define for your representation. On the other hand, what you are trying to do when panning requires a change in the position of the view before the transformation is applied.

To do this, rephrase your code using layers ( CALayer ) and change the layer position property instead of the center view. How in:

 recognizer.view.layer.position = ... 

I think this should fix it.

(You will need to import QuartzCore to compile).

Hope this helps.

+3
source

Source: https://habr.com/ru/post/925904/


All Articles