CORE ANIMATION的介绍
UIView layer
The view’s Core Animation layer used for rendering. (read-only)
This property is never nil. The actual class of the object is determined by the value returned by the layerClass method. The view is the layer’s delegate.
Warning: Since the view is the layer’s delegate, you should never make the view the delegate of another CALayer object. Additionally, you should never change the delegate of this layer object.
The CALayer class is the model class for layer-tree objects. It encapsulates the position, size, and transform of a layer, which defines its coordinate system. It also encapsulates the duration and pacing of a layer and its animations by adopting the CAMediaTiming protocol, which defines a layer’s time space
1.UIView是iOS系统中界面元素的基础,所有的界面元素都继承自它。它本身完全是由CoreAnimation来实现的(Mac下似乎不是这样)。它真正的绘图部分,是由一个叫CALayer(Core Animation Layer)的类来管理。UIView本身,更像是一个CALayer的管理器,访问它的跟绘图和跟坐标有关的属性,例如frame,bounds等等,实际上内部都是在访问它所包含的CALayer的相关属性。
2.UIView有个layer属性,可以返回它的主CALayer实例,UIView有一个layerClass方法,返回主layer所使用的类,UIView的子类,可以通过重载这个方法,来让UIView使用不同的CALayer来显示,例如通过
这是iphone上iBook翻页的效果,假设每一页都是一个UIView,我觉得一个页面是贴了俩个Layer,文字Layer显示正面的内容,背面layer用文字layer的快照做affine翻转,贴在文字layer的后面。因为Layer可以设置显示阴影,也许后面的阴影效果没有使用单独的一个layer来显示。至于这个曲面效果,我查了很多资料也没有结果,估计是使用了GL的曲面绘图?
8.最后一个让人恶心的。
layer可以设置圆角显示,例如UIButton的效果,也可以设置阴影显示,但是如果layer树中的某个layer设置了圆角,树中所有layer的阴影效果都将显示不了了。如果既想有圆角又想要阴影,好像只能做两个重叠的UIView,一个的layer显示圆角,一个的layer显示阴影.....
转自: http://www.cnblogs.com/uyoug321/archive/2011/01/22/1941827.html