I assume you mean why can't you do somethIng like this:
myView.frame.origin.x = 23.0;
It's a good question, nothing silly about it. The problem is that the frame is held as the property of the view, not the individual components of the frame (the size and origin, or even deeper, the width, length, x and y).
The frame is fundamental to the view, so there are lots of actions that a view needs to do if its frame is modified. If you were to reach in and modify the origin.x directly then you would be bypassing the setFrame
method where all of this magic probably happens.
When you access view.frame you are being given a CGRect that has the same value as view.frame, but is not actually the frame, so any modifications to it don't affect the view.
You can do it in steps:
CGRect frame = view.frame;
frame.origin.x = 23.0;
view.frame = frame;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…