Search code examples
iosobjective-ccgaffinetransformcgaffinetransformscale

Distortion after applying not proportional scaling and rotation on a view using CGAffineTransform


So I need to apply scaling and rotation to a view. When perform proportional "x" / "y" scale and then "rotate" view - all looks fine, but when apply not proportional "x", "y" scale and rotate - view distorted example

to perform transformations use CGAffineTransformRotate, CGAffineTransformScale.

I have no idea how to apply rotation to scaled(not proportional) view without distortion.


Solution

  • That happens because geometric transformations using matrices are (generally) not commutative, i.e. the order in which the transformations are applied does matter.

    To get what you want, first apply the scaling and then rotate the scaled image.