Question

A view is flipped using this:

self.transform = CGAffineTransformMakeScale(-1, 1);  // self is an UIView

To rotate this view:

-(void)handleRotate:(UIRotationGestureRecognizer *)recognizer
{
    recognizer.view.transform = CGAffineTransformRotate(recognizer.view.transform, recognizer.rotation);
    recognizer.rotation = 0;
}

The issue is that after the view is flipped so is the rotation's direction. Any solution how to fix this?

Edit: My current solution is using a boolean and negate the recognizer.rotation value in handleRotate method. But I am still looking for the technical solution.

Was it helpful?

Solution

Have you try self.transform.a * recognizer.rotation ?
If I understand correctly the AffineTransform, the X scaling is store at a.

CGAffineTransform Reference Look for CGAffineTransformMakeScale and CGAffineTransformMake

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top