Is it possible to set exclusion paths on a UILabel? The apple documentation states that UILabel is now built upon TextKit but a UILabel does not seem to expose a textContainer property.
I am looking to implement a tableview cell which includes multiple labels and a roux badge which the labels should not overlap (shown below).
If it is not possible with a UILabel how can I make a TextView act like a UILabel (no scroll, selection etc) and size it to fit it's contents?
It is correct that UILabel does not expose the TextKit stack, so you can't set an exclusion path.
However, you don't really need UILabel; it is easy to draw directly with TextKit into a rectangular graphics context, and now you can set an exclusion path (because you are drawing with TextKit). To draw with TextKit, just build the text kit "stack", customizing in any way you like, and then, when it's time to draw, call the layout manager's drawBackgroundForGlyphRange:...
and drawGlyphsForGlyphRange:...
.
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