Animate UIButton state change

前端 未结 5 770
天涯浪人
天涯浪人 2020-12-12 21:00

I\'m using a UIButton with images for normal and highlighted states. They work as expected but I want to have some fading/merging transition and not just a sudden swap.

5条回答
  •  心在旅途
    2020-12-12 21:28

    UIButton inherits from UIView

    So then you get its view and call beginAnimations:context:

    Then all the appropriate setAnimation methods from there.

    The following properties of the UIView class are animatable:

    • @property frame
    • @property bounds
    • @property center
    • @property transform
    • @property alpha
    • @property backgroundColor
    • @property contentStretch

    Ref: UIView Class Reference

提交回复
热议问题