Fade background-color from one color to another in a UIView

前端 未结 1 1053
野性不改
野性不改 2021-02-10 04:54

How can I fade from one background-color to another color in a UIView?

In javascript (jQuery) it can be done by doing the following:
$(\'body\').animate({ back

1条回答
  •  鱼传尺愫
    2021-02-10 05:15

    You don't need to create two UIView and fade - why bother having an extra superfluous view hanging around when the color attribute itself is animatable?

    You can use CAAnimation as shown above, but instead of adjusting the opacity of two views just adjust the backgroundColor of one.

    http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Animation_Types_Timing/Articles/PropertyAnimations.html

    0 讨论(0)
提交回复
热议问题