iPhone文字发光效果

标签 iphone animation graphics glow graphic-effects

在我的 iPhone 应用程序中,我希望 UILabel 中的文本发光一秒钟,然后淡出一秒钟;。我还想重复这个循环 3 到 4 次。

这可能吗?

最佳答案

从 3.2 开始,SDK 中直接支持阴影。

label.layer.shadowColor = [label.textColor CGColor];
label.layer.shadowOffset = CGSizeMake(0.0, 0.0);

调整参数:

label.layer.shadowRadius = 3.0;
label.layer.shadowOpacity = 0.5;

并避免阴影被标签边界剪切:

label.layer.masksToBounds = NO;

别忘了

#include <Quartzcore/Quartzcore.h>

并链接到 QuartzCoreCoreGraphics 框架(感谢评论者指出这一点)。

关于iPhone文字发光效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1420131/

相关文章:

python - 在 matplotlib 中交互式添加和删除散点

opengl - 使用 Z 缓冲区与根据深度确定像素优先级的优点

javascript - 如何制作具有可点击位置的网页图表

iphone - 苹果的推送通知服务可靠吗?

ios - 具有NSAttributedString的可单击UILabel

javascript - 使用 Canvas 和 Html 5 创建类似 Flash 的动画

opengl - “Field of View”和 “lens Length”有什么关系

iphone - UItbaleview Cell json 内容未在 iOS 中显示

iphone - 如何将 touchesEnded 转移到由 touchesBegan 在不同的 UIView 上添加的 UIView?

javascript - 使用 jQuery Isotope 进行过滤会导致动画不稳定