iOS 从一个位置到另一个位置对视图进行动画处理。
示例
目标C
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position.x"];
animation.fromValue = @0;
animation.toValue = @320;
animation.duration = 1;
[_label.layer addAnimation:animation forKey:@"basic"];迅速
let animation = CABasicAnimation(keyPath: "position.x") animation.fromValue = NSNumber(value: 0.0) animation.toValue = NSNumber(value: 320.0) _label.layer.addAnimation(animation, forKey: "basic")
视图将水平从0移到320。如果要将视图垂直移动,只需像这样替换键路径:
"position.y"
热门推荐
10 五一祝福语大全简短最新
11 枣庄人事考试祝福语简短
12 女儿升学宴祝福语简短
13 收围巾的祝福语简短
14 行公司生日祝福语简短
15 上司生日祝福语简短 女性
16 牙医生日祝福语简短
17 新年元旦祝福语大全简短
18 猪年给老师祝福语简短