I am releasing a UILabel subclass, which allows shadow blur, stroke text and fill gradient. You can find it here: tobihagemann/THLabel
- I needed an outer stroke, which seems to be kind of special, because Core Graphics only can centered stroke. I found the neat solution in KSLabel, which doubles the stroke size and draws the text just over it again, which cuts the stroke into halves.
- The stroke manipulates the character glyph widths, which has to be dealt with in all style operations. I came up with the idea of using invisible strokes, which works perfectly.
- Shadow has to be also thrown off by the stroke, not the text only!
I had to reorganize the
drawRect: method several times, which caused me a lot of headache. For learning purposes I built the class from ground up, that’s why I didn’t just enhance FXLabel for example.
If you find any bugs or want to give feedback, I’m happy to hear them!