5

I know that there are multiple ways (CAAnimation, commitAnimations, etc), but what is the simplest way?

I'd like the UIView to start from blue and then fade to clear (or white, whatever is easier) in X milliseconds.

1 Answer 1

11

You can use UIView's animation method. It's much simpler than the other animations, but is more limited. Luckily, backgroundColor is one of the animatable ones. Example:

self.view.backgroundColor = UIColor.blueColor()

UIView.animateWithDuration(1.0, animations: {
    self.view.backgroundColor = UIColor.clearColor()
})
1
  • 1
    Agreed on using UIView animation. (Voted). Much simpler than CAAnimation.
    – Duncan C
    May 4, 2016 at 22:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.