UIView基本动画
// MARK: - UIView动画 ------------------------------------- // MARK: - UIView动画-淡入 @IBAction func simpleAnimationFadeIn() { UIView.beginAnimations(nil, context: nil) UIView.setAnimationDuration(2.0)//设置动画时间 testImageView.alpha = 0.0 UIView.commitAnimations() // //通过闭包实现 UIView淡入小狗 // UIView.animateWithDuration(0.3, animations: { () -> Void in // self.testImageView.alpha = 0.0 // }) } // MARK: - UIView动画-淡出 @IBAction func simpleAnimationFadeOut() { UIView.beginAnimations(nil, context: nil) UIView.setAnimationDuration(2.0)//设置动画时间 testImageView.alpha = 1.0 UIView.commitAnimations() } // MARK: - UIView动画-移动 @IBAction func simpleAnimationMoveCenter() { UIView.beginAnimations(nil, context: nil) UIView.setAnimationDuration(2.0)//设置动画时间 testImageView.center = CGPointMake(, ) UIView.setAnimationCurve(UIViewAnimationCurve.EaseOut)//设置动画相对速度 UIView.commitAnimations() } // MARK: - UIView动画-大小调整 @IBAction func simpleAnimationFrame() { UIView.beginAnimations(nil, context: nil) UIView.setAnimationDuration(2.0)//设置动画时间 testImageView.frame = CGRectMake(, , , ) UIView.commitAnimations() }