美文网首页
CALayer相关

CALayer相关

作者: NapoleonY | 来源:发表于2018-04-27 22:27 被阅读8次

    anchorPoint, position

    如果要把一张A4纸用图钉钉在桌子上。图钉在纸上的位置就是anchorPoint,而图钉在桌子上的位置就是position。因此position是相对于super Layer而言的,而anchorPorint是相对于sub Layer而言的。
    总的来讲,sub Layer中anchorPoint所在的位置(图钉在A4纸上的位置,这也是anchorPoint中x、y取值范围在0~1的原因),就是super Layer中position所在的位置(图钉在桌子上的位置)。
    结合sub view的bounds属性,就能计算出view的frame属性

    参考

    1. iOS-彻底理解position与anchorPoint

    相关文章

      网友评论

          本文标题:CALayer相关

          本文链接:https://www.haomeiwen.com/subject/ugzilftx.html