美文网首页
swift 动画图片旋转,更新转圈效果

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

作者: 呆呆_fdd9 | 来源:发表于2019-03-06 13:09 被阅读0次

方法一

 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")

相关文章

网友评论

      本文标题:swift 动画图片旋转,更新转圈效果

      本文链接:https://www.haomeiwen.com/subject/fcytpqtx.html