一个桢动画学习
UIView.animateKeyframesWithDuration(2.0, delay: 0.0, options: UIViewKeyframeAnimationOptions.LayoutSubviews, animations: { () -> Void in UIView.addKeyframeWithRelativeStartTime(0.0, relativeDuration: 0.5, animations: { () -> Void in self.imageView.center = CGPointMake(100, 100) }) UIView.addKeyframeWithRelativeStartTime(0.0, relativeDuration: 0.5, animations: { () -> Void in let rotation:CGFloat = CGFloat(45*M_PI / 180.0) self.imageView.transform = CGAffineTransformMakeRotation(rotation) }) UIView.addKeyframeWithRelativeStartTime(0.0, relativeDuration: 0.5, animations: { () -> Void in self.imageView.backgroundColor = UIColor.greenColor() }) }) { (finished:Bool) -> Void in print("Animation completed:\(finished)") }