showLoading

使用CABasicAnimation

keyPath = 'transform.rotation.z'

一圈一秒.圈数设置无限大.

增加到控件的layer上面.



private func showLoading(){

loadingImage.isHidden = false

let basicAni: CABasicAnimation = CABasicAnimation()

basicAni.keyPath = "transform.rotation.z"

basicAni.fromValue = 0

basicAni.toValue = -M_PI * 2

basicAni.duration = 1

basicAni.repeatCount = MAXFLOAT

self.loadingImage.layer.add(basicAni, forKey: nil)

}

你可能感兴趣的:(showLoading)