Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

About UIRotationGestureRecognizer

Can I get the middle point coordinate of the UIRotationGestureRecognizer's two fingers? Or the location of each finger? Thank you.

like image 920
Jack G Avatar asked Jun 13 '26 00:06

Jack G


2 Answers

You can get either.

The docs for UIRotationGestureRecognizer show the properties velocity and rotation.

This is specific to the rotation.

But you can use these methods from the UIGestureRecognizer...

Getting the Touches and Location of a Gesture
– locationInView:
– locationOfTouch:inView:
– numberOfTouches

To get the touches and locations.

From these you can easily calculate the mid point.

like image 98
Fogmeister Avatar answered Jun 14 '26 13:06

Fogmeister


UIRotationGestureRecognizer extends UIGestureRecognizer which has the two methods: numberOfTouches and locationOfTouch:inView:. Use these to get the location of each finger. From there you can calculate a center.

like image 35
rmaddy Avatar answered Jun 14 '26 12:06

rmaddy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!