如何为 UILabel 的颜色设置动画?
可能的重复:
如何为 UILabel 的背景颜色设置动画?
我对在 iOS 上制作动画还很陌生,并且有一个基本问题。
我有一个 UILabel,我想短暂更改其颜色。基本上,在 cellForRowAtIndexPath: 内部,我大约每 15 秒重新加载一次单元格。如果某个单元格满足要求,我想短暂更改标签的颜色并设置动画使其淡出回到原始颜色。
弹出,淡出。
任何提示都会很棒。谢谢你们。
Possible Duplicate:
How to animate the background color of a UILabel?
I'm pretty new to animating things on iOS and have a basic question.
I have a UILabel that I want to briefly change the color of. Basically, inside of cellForRowAtIndexPath: I am reloading my cell's every 15 seconds or so. If a certain cell meet's a requirement, I want to briefly change the label's color and animate it to fade off back to it's original color.
Pop on, fade out.
Any tips would be amazing. Thanks guys.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是最明智的解决方案,但它可能会满足您的需求:创建一个相同的新 UILabel,具有相同的框架、字体等......但具有不同的颜色。使用可动画的“alpha”属性淡出旧颜色,看起来就像底层标签的颜色正在过渡。
This isn't the brightest solution, but it might get you to what you need: Create an identical, new UILabel with the same frame, font, etc... but with a different color. Use the animatable "alpha" property to fade your old color out and it will seem as if the underlaying label's color is being transitioned in.