UIView 以及 CALayer 都有一套自己的定位机制,当你要自己绘制自定义控件的时候是非常重要的。UIView 有 frame、bounds、center,CALayer 有 frame、bounds、anchorPoint、position,这些属性又各有用处,相互之间也有关联。
我看了介绍 UIView 和 Core Animation 的相关官方文档[1][2]和博客文章[3]后对这些概念有一个大体的认识(依然比较模糊),但是对于它们相互之间的影响关系以及更深层次的应用有些不解。
特别是,CALayer 的相关属性和 UIView 的相关属性之间的联系是怎样的?UIView 作为自己的 CALayer 的 delegate,是怎么去代理自己的 CALayer 对象的?
麻烦前辈们根据自己的经验指教一下啊,多谢 :)。
[1]
https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/Introduction/Introduction.html[2]
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html[3]
http://wonderffee.github.io/blog/2013/10/13/understand-anchorpoint-and-position/