标签:
--------------------
CALayer
手动创建的layer 修改某些属性 默认有动画 头文件中看到属性描述有animatin的都是有默认动画的
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. 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 = layer; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { // 关闭隐式动画 // [CATransaction begin]; // [CATransaction setDisableActions:YES]; // 隐式动画 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 commit]; } @end
标签:
原文地址:http://www.cnblogs.com/zff193/p/5261239.html