Gesture gesture after rotation behaves incorrectly

I have a similar question as in the link below

Why am I using "pan" after rotae pretends in the opposite way?

But this link also did not solve my problem. I use pan, pinch and rotation for the same UIImage. When I rotate this image and perform panning, it will give random panning (sometimes it happens in the opposite direction of panning. I also set the anchor point (0.5.0.5)). But, if I use only panning (that is, before rotation), it will work fine as expected. How can I solve this problem?

+6
source share
2 answers

Finally, I solved this problem ... You just need to change the code below CGPoint translation = [gesture translationInView:gesture.view]; on CGPoint translation = [gesture translationInView:[gesture.view superview]]; present within the UIPanGestureRecognizer method.

OR follow the link below http://cs354dory.wordpress.com/code-examples/pinch-pan-and-rotate/

+4
source

I decided that too.

Just put these 2 lines of code in a rotation function.

 gestureRecognizer.view.transform = CGAffineTransformRotate(gestureRecognizer.view.transform, gestureRecognizer.rotation); gestureRecognizer.rotation = 0; 
+1
source

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


All Articles