I\'m trying to animate a rotation of 180 degrees of a UIImageView
in Swift
UIView.animateWithDuration(1.0, animations: { () -> Void in
Updated swift 4.0 version:
let rotation: CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
rotation.toValue = Double.pi * 2
rotation.duration = 0.25 // or however long you want ...
rotation.isCumulative = true
rotation.repeatCount = Float.greatestFiniteMagnitude
yourView.layer.add(rotation, forKey: "rotationAnimation")