Animation iOS 动画 -- swift

UIView.beginAnimations("MyAnimation", context: nil) //开始动画 设置动画ID

UIView.setAnimationCurve(.EaseIn) //运动曲线 先慢后快

UIView.setAnimationDuration(2.0) //动画时间


iconImage.frame = frame  //动画内容


UIView.setAnimationDelegate(self) // 设置动画代理

UIView.setAnimationDidStopSelector(Selector("changeStation")) //动画结束时调用方法

UIView.commitAnimations()  //  开始动画



//动画效果:第二启动页2.5s展示过后经0.2秒删除并恢复展示NavbarTitleView

UIView.animateWithDuration(2.5, animations: { () -> Void in

launchView.alpha = 1

}) { (finished) -> Void in

UIView.animateWithDuration(0.2, animations: { () -> Void in

launchView.alpha = 0

self.navigationItem.titleView?.hidden = false

self.navigationItem.setLeftBarButtonItem(leftButton, animated: false)

}, completion: { (finished) -> Void in

launchView.removeFromSuperview()

})

}

你可能感兴趣的:(Animation iOS 动画 -- swift)