kaar3k
kaar3k

Reputation: 994

UIView size after transform

I need to get the size of UIView after applying transform such as CGAffineTransformScale and CGAffineTransformRotate .I use the below method to get the size of the view but i am not able to get the accurate size after applying CGaffineTransformRotate.

  CGSizeApplyAffineTransform(view.bound.size,view.transform)

I am using this method because view.frame becomes NULL after applying transform.As mentioned in apple docs. Thanks for help.

Upvotes: 1

Views: 936

Answers (1)

matt
matt

Reputation: 535139

The notion of "size" has no obvious meaning after application of a transform, and especially a rotation transform. That is why you are not supposed to access the frame of a view whose transform is not the identity transform. CGSizeApplyAffineTransform certainly does give accurate information under one interpretation of the notion of size (and so does frame, which gives a nonrotated bounding box). You might want to think further, though, about why you believe you need this information.

Upvotes: 1

Related Questions