Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
512 views
in Technique[技术] by (71.8m points)

animation - IPhone Text Glow Effect

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.

Is this possible?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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);

Play with the parameters:

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

And to avoid shadow being clipped by the label bouds:

label.layer.masksToBounds = NO;

Don't forget to

#include <Quartzcore/Quartzcore.h>

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...