47.隐式动画

来源:互联网 发布:godaddy域名实名认证 编辑:程序博客网 时间:2024/05/18 03:17
1.隐式动画:每一个UIView内部都默认关联着一个CALayer,我们可用称这个Layer为Root Layer(根层)所有的非Root Layer,也就是手动创建的CALayer对象,都存在着隐式动画什么是隐式动画?当对非Root Layer的部分属性进行修改时,默认会自动产生一些动画效果而这些属性称为Animatable Properties(可动画属性)    CALayer *layer = [CALayer layer];    layer.backgroundColor = [UIColor redColor].CGColor;    layer.bounds = CGRectMake(0, 0, 100, 100);    layer.anchorPoint = CGPointZero;    [self.view.layer addSublayer:layer];    隐式动画:     // 隐式动画    self.layer.backgroundColor = [UIColor greenColor].CGColor;    //self.layer.bounds = CGRectMake(0, 0, 200, 200);    self.layer.position = CGPointMake(200, 200);    // self.layer.position // 如何查看CALayer的某个属性是否支持隐式动画, 查看头文件是否有 Animatable关闭隐式动画:    关闭隐式动画    [CATransaction begin];    [CATransaction setDisableActions:YES];    // 隐式动画    self.layer.backgroundColor = [UIColor greenColor].CGColor;   [CATransaction commit];
0 0
原创粉丝点击