I happened to something strange to me on CALayer.And finally found the CALayer's frame.size not equal to its bounds.size, which I couldn't understand.I know frame is in the super's coordinate system and bounds is its own coordinate,and the usual case is frame.origin is not equal to bounds.origin but frame.size is equal to bounds.size.
问题:
回答1:
That is because you applied a transform, as apple says on the documentation for the frame property.
Warning If the transform property is not the identity transform, the value of this property is undefined and therefore should be ignored.
...
Changes to this property can be animated. However, if the transform property contains a non-identity transform, the value of the frame property is undefined and should not be modified. In that case, you can reposition the view using the center property and adjust the size using the bounds property instead.
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIView_Class/UIView/UIView.html
If you do not have a transform applied then the origin might be different but the size should remain the same as adjusting one re adjusts the other.
The size of the bounds rectangle is coupled to the size of the frame rectangle, so that changes to one affect the other.