一:Swift3.0为视图添加旋转动画,效果如下: 代码实现: //创建动画 let anim = CABasicAnimation(keyPath: "transform.rotation") //设置相关属性 anim.toValue = 2