hgpl hgpl - 3 months ago 25
Objective-C Question

Outline for UILabel text

How do I add a black outline to my white UILabel text?

Answer

One option is to set the shadow, which might not be exactly what you want, but achieves a similar effect. You can manually adjust the offset:

UILabel *myLabel = ...;
lbl.shadowColor = [UIColor whiteColor];
lbl.shadowOffset = CGSizeMake(0, -1.0);

Please note that you can also define this in Interface Builder for your UILabel.

shadow

If this is not enough for you check out this blog post which deals with subclassing UILabel to get a glow effect:

glow