Search code examples
ioscocoacgaffinetransformcgrect

How to get CGRect that exactly represents the views bounds and transformation?


How can I get the transformed rect of an UIView, including translations and scaling made in the .transform property? I tried to do it this way:

CGRect transformed = CGRectApplyAffineTransform(theview.frame, theview.transform);

Doesn't work!?


Solution

  • You should use UIView bounds property for that, i.e.

    CGRect trans_rect = CGRectApplyAffineTransform(view.bounds, view.transform);