闪烁的 UILabel Cocoa Touch
是否可以在 Cocoa Touch 中制作一个闪烁的 UILabel,或者我是否需要一个带有核心动画的 UIview?
Is it possible to make a blinking UILabel in Cocoa Touch or do I need an UIview with Core Animation for that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
听取 Martin 的建议,然后查看 NSTimer 来处理“眨眼”动作。
+ ScheduledTimerWithTimeInterval:目标:选择器:userInfo:重复:
Take Martin's advice, and then have a look at NSTimer to handle the "blink" actions.
+ scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:
所有 UIView(包括 UILabel)都有一个
hidden
属性,您可以打开和关闭该属性以使其“闪烁”。All UIViews (including UILabel) has a
hidden
property which you can toggle on and off to make it "blink".为了好玩,我决定编写这个 NSOperation 子类。
摘自 BlinkingLabelOperation.m
示例视图控制器代码:
有关完整列表,您可以在此处找到它。请发表评论并让我知道您的想法。
For fun, I decided to write this subclassing NSOperation.
Excerpt from BlinkingLabelOperation.m
Sample view controller code:
For a complete listing, you will find it here. Please leave comments and let me know what are your thoughts.