以下是我的代碼。 淡出效果正常。然而,淡入淡出效果並非動畫效果。 我無法解決這個問題。感謝那些能幫助我的人。 阿爾法在故事板FadeIn動畫不工作swift 2
extension UIView {
func fadeIn(duration: NSTimeInterval = 3.0, delay: NSTimeInterval = 0.0, completion: ((Bool) -> Void) = {(finished: Bool) -> Void in}) {
UIView.animateWithDuration(duration, delay: delay, options: UIViewAnimationOptions.CurveLinear, animations: {
self.alpha = 1.0
}, completion: completion) }
func fadeOut(duration: NSTimeInterval = 2.0, delay: NSTimeInterval = 3.0, completion: (Bool) -> Void = {(finished: Bool) -> Void in}) {
UIView.animateWithDuration(duration, delay: delay, options: UIViewAnimationOptions.CurveEaseOut, animations: {
self.alpha = 0.0
}, completion: completion)
}
}
ru試圖在淡出後直接進行淡入? – mtaweel
淡入淡出後沒有淡出 –