【问题标题】:Cocoa - UIButton fade transition between UIControlStateNormal and UIControlStateDisabled background imageCocoa - UIControlStateNormal 和 UIControlStateDisabled 背景图像之间的 UIButton 淡入淡出过渡
【发布时间】:2011-05-25 12:41:30
【问题描述】:

我创建了一个 UIButton 子类来实现我的应用程序中需要的其他功能。

我为状态 UIControlStateNormal 和 UIControlStateDisabled 设置了两个不同的背景图像。

当我设置我的按钮启用或禁用时,我希望它在 UIControlStateNormal 图像和 UIControlStateDisabled 图像之间具有淡入淡出动画。

如何在我的 UIButton 子类中做到这一点?

【问题讨论】:

    标签: objective-c cocoa-touch animation uibutton


    【解决方案1】:

    UIButton 会自动为您做很多事情,如果您想添加自定义行为,最终可能很难获得您正在寻找的那种动画。

    我会自己使用 UIControl(UIButton 超类)并使用 CALayer 隐式(或显式)animations 更改背景图像。

    【讨论】:

      猜你喜欢
      • 2016-05-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-20
      • 2013-05-24
      • 1970-01-01
      相关资源
      最近更新 更多