IPhone Text Glow Effect

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

Leave a Comment