Difference between flipping a view using rotation and scale transforms

394 Views Asked by At

Is there any (performance) difference between flipping / rotating a symmetric image using rotation and scale transform like in the examples below?

view.transform = CGAffineTransformMakeScale(1, -1);
view.transform = CGAffineTransformMakeRotation(180 / 180.0 * M_PI);
1

There are 1 best solutions below

2
On BEST ANSWER

First of all, the two examples you provide are not the same transformations at all. (as you pointed out in the comments; but because of the symmetry it will not matter to you.) But there is no difference between

CGAffineTransformMakeScale(-1, -1);

and

CGAffineTransformMakeRotation(M_PI);

CGAffineTransform is just a 3x3 matrix with a special purpose. You can find some examples in the documentation. It doesn't matter with which function the matrix is created.

You might be able to check this with CGAffineTransformEqualToTransform, though floating point comparisons could mess up things.