每一个iOS开发者都知道UIView有一个layer的属性,layer的属性是CALayer,CALayer本身不包含在UIKIT框架中,他不能响应事件。当你改变`CALayer`的一个可做动画的属性,它并不能立刻在屏幕上体现出来,由于CALayer在设计之初就考虑它的动画操作功能,CALayer很多属性在修改时都能形成动画效果,这种属性称为“隐式动画属性”。
- (void)viewDidLoad {
隐式动画的创建

背景颜色动画

圆角半径动画

执行结果如下



CALayer还有很多的属性可以进行设置,在苹果的文档中搜索:CALayer Animatable Properties ,查看更多。如下图是CALayer的基本属性,当需要的时候可以查看。

网友评论