【问题标题】:How to fade the colour of a button to another colour?如何将按钮的颜色淡化为另一种颜色?
【发布时间】:2013-11-20 18:33:41
【问题描述】:

当按下另一个按钮时,我试图将按钮从一种颜色(红色)更改为另一种颜色(黄色)。我目前从红色突然变为黄色,并想添加一个快速动画以使过渡更平滑一些。我该怎么做呢?任何帮助将不胜感激。

【问题讨论】:

标签: objective-c button uiview uicolor


【解决方案1】:

UI更新应该发生在主线程中,但是动画方法在UIView中,它的意思是:

[UIView animateWithDuration:desiredDuration animations:^{
object.property = newValue;
}];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多