iOS锚点
介绍iOS图层中d的锚点anchorPoint
AnchorPoint 锚点
视图(View)的center属性跟图层(Layer)的position属性都指定了anchorPoint相对于父图层的位置。图层的anchorPoint通过position来控制它frame的位置. 可以说anchorPoint是用来移动图层的把柄.
默认的,anchorPoint位于图层中点,所以图层会以这个点为中心放置. anchorPoint的属性在UIVIew没有被暴露出来,这也是View的position叫做center的原因.
但是图层的anchorPoint可以被移动.比如,你可以把它置于图层frame的左上角,于是图层的内容就会向右下角的position移动,而不是居中了.
