Azerue Azerue - 2 months ago 22
iOS Question

CGAffineTransform does not effect autolayout

Hello recently i have been working with CGAffineTransform and CATransform3D on views and layers. When i apply transformation at layer level and especially on view level, shouldn't autolayout updates the frames of related views. For example Consider following Layout |H:[ViewA]-[ViewB]|. If i apply transformation on just ViewA.

//We can either
ViewA.transform = CGAffineTransformMakeScale(1.5, 1.5)
ViewA.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.0)

shouldn't ViewB auto adjust it rect since ViewA height, width or position has changed after transformation. i also tried calling



Transformations don't affect the Frame or Bounds of a view or the frame will be in an undefined state. To illustrate that: image you have a rectangular view with a frame of X:10, Y:10, W:100, H:100 and you rotate that by 45 degrees...what should the frame be?

From Apple's docs about the transformation:

If this property is not the identity transform, the value of the frame property is undefined and therefore should be ignored.

This explains why AutoLayout does not perform any updates.