I want to rotate the image in clockwise or anticlockwise direction corresponding to the user touch drag with its speed. I think this can be done with some math and logic. What would a code sample for this look like?
I want to rotate the image in clockwise or anticlockwise direction corresponding to the
Share
If you’re targeting iOS 3.2 or greater, you can use
UIRotationGestureRecognizer. The code would look something like this:In your setup method (
viewDidLoadorinit, etc,):The event handler:
I have some more examples of gesture recognizers (including the one above) on github.