How do I add a black outline to my white UILabel text?
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 http://i.minus.com/jbiG0jVdOxJbgh.png
If this is not enough for you check out this blog post which deals with subclassing UILabel
to get a glow effect:
(source: redrobotstudios.com)
Disclosure: I'm the developer of THLabel.
I've released a UILabel subclass a while ago, which allows an outline in text and other effects. You can find it here: https://github.com/tobihagemann/THLabel
I'm using Core Text and Core Graphics to achieve the effect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With