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"
热门推荐
8 医政科祝福语简短
10 合字的祝福语简短
11 红颜生日祝福语简短独特
12 简短的祝福语12字
13 公司开年仪式祝福语简短
14 过年爱情祝福语大全简短
15 妹妹生日祝福语简短唯美
16 给宝贝开学祝福语简短
17 高考祝福语简短10字
18 奶奶生日感恩祝福语简短