iPhone 文字发光效果 [英] IPhone Text Glow Effect

查看:35
本文介绍了iPhone 文字发光效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In my IPhone application, I want the text in UILabel to glow for a second, then fade for a sec;. Also i want to repeat this cycle for say 3 or 4 times.

这可能吗?

推荐答案

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

As of 3.2 you there is direct support for shadows in the 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;

并避免阴影被标签包剪掉:

And to avoid shadow being clipped by the label bouds:

label.layer.masksToBounds = NO;

别忘了

#include <Quartzcore/Quartzcore.h>

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

and link against the QuartzCore or CoreGraphics frameworks (thanks to commenters for pointing this out).

这篇关于iPhone 文字发光效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆