1.图层的某些属性更改后,会有一个渐变的动画,通常称为隐式动画
- (void)viewDidLoad
{
[super viewDidLoad];
CALayer *layer = [CALayer layer];
layer.frame = CGRectMake(150, 100, 100, 100);
layer.backgroundColor = [UIColor redColor].CGColor;
self.myLayer = layer;
[self.view.layer addSublayer:layer];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
self.myLayer.frame = CGRectMake(200, 200, 50, 50);
}
2.图层的属性,不全是可动画的,详见苹果官方文档