CABasicAnimation中的锚点

来源:互联网 发布:透明图标软件 编辑:程序博客网 时间:2024/06/05 05:09

下图中,上半部分的anchorPoint为(0.5, 0.5),即anchorPoint为layer的中心。下半部分的anchorPoint为(0.0, 0.0),即anchorPoint为layer的左上角。同理我们可知,anchorPoint如果为(1.0, 1.0)的化就代表右下角。(注意iOS与OS X坐标系的不同)

anchor points解释

下面这张图更清晰的解释了Anchor Points对layer的transformations变化的影响:

anchor points影响

对于iOS,可以总结anchorPoint值对应layer的位置如下图:

请输入图片描述

设置view.layer的anchorPoint为(0.0, 1.0)即可以左下角为中心旋转。

0 0
原创粉丝点击