1.简介:

最近在学习动画,所以接触到了CAlayer类。

其中的position与anchorPoint关系一感觉一头雾水,网上有篇文章

彻底理解position和anchorPoint关系  里面讲的很通俗易懂,我也是看了这篇文章后总结出了自己一个
阐述两者关系的现实映射。vv

2.总结

我们要往墙上钉一块板,有一颗钉子,钉子强度不能破墙。所以事先需要在墙上敲一个洞。

钉子钉下去的点类比:anchorPoint  锚点

墙上的洞的位置类比:position

板类比为:subLayer

墙类比为:superLayer

1.首先定义的钉的点和和墙上的洞必须重叠,这样才能钉住不是吗?所以说anchorPoint和position其实是一个点,只是前者在板上描述,后者在墙上描述(坐标系不同)。

2.当墙上的洞保持不变,而钉子的位置改变,那么我们是不是应该移动板去让两个点重合然后才能钉住,对吧。

3.反之钉子在板上位置不变,而墙上的洞变了位置,我们是不是还是应该移动板去让两个点重合然后才能钉住,对吧?

所以这就解释了为什么两者无论改变哪一方,都会在成subLayer的移动。

[Think] position与anchorPoint关系的更多相关文章

  1. 彻底理解position与anchorPoint

    引言 相信初接触到CALayer的人都会遇到以下几个问题: 为什么修改anchorPoint会移动layer的位置?CALayer的position点是哪一点呢?anchorPoint与positio ...

  2. position与anchorPoint

    相信初接触到CALayer的人都会遇到以下几个问题: 为什么修改anchorPoint会移动layer的位置?CALayer的position点是哪一点呢?anchorPoint与position有什 ...

  3. 彻底理解position与anchorPoint - Wonderffee's Blog(转)

    引言 相信初接触到CALayer的人都会遇到以下几个问题: 为什么修改anchorPoint会移动layer的位置?CALayer的position点是哪一点呢?anchorPoint与positio ...

  4. iOS-CALayer中position与anchorPoint详解

    iOS-CALayer中position与anchorPoint详解 属性介绍 CALayer通过四个属性来确定大小和位置, 分别为:frame.bounds.position.anchorPoint ...

  5. CALayer 易混淆的两个属性 - position和anchorPoint

    1.简单介绍 CALayer有2个非常重要的属性:position和anchorPoint @property CGPoint position;                           ...

  6. Position和anchorPoint

    Main.storyboard ViewController.m // //  ViewController.m //  7A12.position和anchorPoint // //  Create ...

  7. iOS开发——使用OC篇&frame,bounds,center,position,anchorPoint总结

    frame,bounds,center,position,anchorPoint总结 图层的 position 属性是一个 CGPoint 的值,它指定图层相当于它父图层的位置, 该值基于父图层的坐标 ...

  8. CALayer属性:position和anchorPoint

    一.position和anchorPoint 1.简单介绍 CALayer有2个非常重要的属性:position和anchorPoint @property CGPoint position; 用来设 ...

  9. 【总结整理】display与position之间的关系【较完整】(转)

    display与position之间的关系   以防自己忘记写的 网上找的 positon 与 display 的相互关系 元素分为内联元素和区块元素两类(当然也有其它的),在内联元素中有个非常重要的 ...

随机推荐

  1. 转:概率主题模型简介 --- ---David M. Blei所写的《Introduction to Probabilistic Topic Models》的译文

    概率主题模型简介 Introduction to Probabilistic Topic Models      转:http://www.cnblogs.com/siegfang/archive/2 ...

  2. 【转】Unity+单例模式的依赖注入

    http://www.cnblogs.com/floyd/archive/2009/06/17/1505117.html

  3. POJ2104:K-th Number——题解

    http://poj.org/problem?id=2104 题目大意:求区间第k小. —————————————————————————— 主席树板子题. ……我看了半天现在还是一知半解的状态所以应 ...

  4. BZOJ5288 & 洛谷4436 & LOJ2508:[HNOI/AHOI2018]游戏——题解

    https://www.lydsy.com/JudgeOnline/problem.php?id=5288 https://www.luogu.org/problemnew/show/P4436 ht ...

  5. 51NOD 1149:Pi的递推式——题解

    http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1149 F(x) = 1 (0 <= x < 4) F(x) ...

  6. 2017-7-18-每日博客-关于Linux下的鲜为人知的10条命令.doc

    这篇文章的目的是介绍一些少有人知的Linux命令,它们一定会高效地帮你管理你的桌面/服务器. 1. sudo !!命令 没有特定输入sudo命令而运行,将给出没有权限的错误.那么,你不需要重写整个命令 ...

  7. ubuntu16.04命令行模式黑屏解决办法

    ubuntu16.04命令行模式黑屏解决办法 问题描述 在ubuntu上装Nvidia的显卡驱动,需要关闭图形界面才能安装驱动,但是,出现如下情况: 使用“ctrl+alt+F1”命令进入命令行界面是 ...

  8. Educational Codeforces Round 6 C

    C. Pearls in a Row time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  9. bzoj 2086 [Poi2010]Blocks 单调栈

    [Poi2010]Blocks Time Limit: 20 Sec  Memory Limit: 259 MBSubmit: 788  Solved: 356[Submit][Status][Dis ...

  10. Codeforces Round #407 (Div. 2) D,E

    图论 D. Weird journey time limit per test 2 seconds memory limit per test 256 megabytes input standard ...