swift 动画图片旋转,更新转圈效果

2019-03-06  本文已影响0人  呆呆_fdd9

方法一

 letmomAnimation =CABasicAnimation(keyPath:"transform.rotation.z")

            momAnimation.fromValue=NSNumber(value:0)//左幅度

            momAnimation.toValue=NSNumber(value:Double.pi*2)//右幅度

            momAnimation.duration=1

            momAnimation.repeatCount=HUGE//无限重复

            (self.navigationItem.rightBarButtonItem?.customView! as! UIButton).imageView!.layer.add(momAnimation, forKey: "centerLayer")

方法二

letmomAnimation =CABasicAnimation(keyPath:"transform.rotation.z")

            momAnimation.fromValue=NSNumber(value:0)//左幅度

            momAnimation.toValue=NSNumber(value:Double.pi*2)//右幅度

            momAnimation.duration=1

            momAnimation.repeatCount=HUGE//无限重复

            btnUpdate.imageView?.layer.add(momAnimation, forKey:"centerLayer")

上一篇 下一篇

猜你喜欢

热点阅读