好吧,我有一个 CALayerlayer
我想用 CADisplaylink 移动它。喜欢 :
layer.center=CGPointMake(layer.center.x + 10, layer.center.y + 10);
但我不能用center
or position
这是我的问题,我想让它像 uiimageview 一样移动。
要移动图层尝试使用此方法
-(void)moveLayer:(CALayer*)layer to:(CGPoint)point{
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"];
animation.fromValue = [layer valueForKey:@"position"];
animation.toValue = [NSValue valueWithCGPoint:point];
layer.position = point;
[layer addAnimation:animation forKey:@"position"];
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)