iphoneioscocoa-touchcgaffinetransformscale

Calculating Scale for a UIView


Suppose the current scale of my UIView is x. Suppose I apply a scale transformation to my UIView of the amount y ie:

view.transform = CGAffineTransformScale(view.transform, y, y);

. How do I determine what the value of the scale of the UIView after the scale transformation occurs (in terms of x and y?).


Solution

  • The scale transform multiplies the current scale with your scale y. if the scale was 2.0 for retina, it is y* 2.0 afterwards.
    So x*y is the answer. but dont forget x.achsis scale and y achsis can be different.
    x, and y for scale is confusing, better use s1 and s2, or sx, sy if you have different scale on y and x achsis, in your code.