UIViews and CGAffineTransformMakeScale

I'm a little confused. Let's say I have a UIView named myView, and we have the following block of code:

[myView setTransform:CGAffineTransformMakeScale(2.0f, 2.0f)];
[myView setTransform:CGAffineTransformMakeScale(0.5f, 0.5f)];

Now, if I looked at this code I would assume that this would leave the UIView's size unchanged. However, it actually makes it half of its original size! It seems that UIViews have some sort of "memory" about what their original size was. Is this correct? This also seems like a very weird choice that Apple made, and I was hoping someone could enlighten me about exactly what's going on and why it is the way it is.



A UIView's frame property is its bounding rectangle in the coordinate space of its superview.

Its bounds property, on the other hand, is the bounding rectangle in the view's own coordinate space.

The halving of the view's size, therefore, would be seen in its frame.size (because its size is halved w.r.t. its superview) but not in its bounds.size (because the view itself still has the same size).

Need Your Help

How to avoid large matrix multiplication in Matlab

matlab matrix matrix-multiplication enumerate large-scale

There are two large matrices in my code, which have the same number of columns and different number of rows. Like A(20000X4000) and B(30000X4000). Both are 0-1 sparse.