码迷,mamicode.com
首页 > 其他好文 > 详细

position和anchorPoint

时间:2015-03-15 13:41:49      阅读:91      评论:0      收藏:0      [点我收藏+]

标签:

CALayer有2个非常重要的属性:position和anchorPoint

 

@property CGPoint position;

用来设置CALayer在父层中的位置

以父层的左上角为原点(0, 0)

 

@property CGPoint anchorPoint;

称为“定位点”、“锚点”

决定着CALayer身上的哪个点会在position属性所指的位置

以自己的左上角为原点(0, 0)

它的x、y取值范围都是0~1,默认值为(0.5, 0.5)

 

 

红色图层的anchorPoint是(0,0)

红色图层的anchorPoint是(0.5,0.5)

红色图层的anchorPoint是(1,1)

红色图层的anchorPoint是(0.5,0)

红色图层的anchorPoint是(1,0.5)

 

position和anchorPoint

标签:

原文地址:http://www.cnblogs.com/LennyKwok/p/4339603.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!