CALayer frame.size not equal to bounds.size

我与影子孤独终老i 提交于 2019-12-03 17:07:31

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!