Exclusion paths in a UILabel text container

Is it possible to set exception paths on UILabel? The Apple documentation states that UILabel is now built on TextKit, but UILabel does not seem to provide the textContainer property.

I want to implement a tableview cell that includes several labels and a roux marker that the labels should not overlap (shown below).

enter image description here

If this is not possible with UILabel, how can I make a TextView action like a UILabel (without scrolling, highlighting, etc.) and size it to fit its contents?

+7
ios objective-c iphone uitableview textkit
source share
1 answer

It is true that UILabel does not open the TextKit stack, so you cannot set an exception path.

However, you do not need UILabel; it's easy to draw directly with TextKit in the context of rectangular graphics, and now you can set the exception path (because you draw using TextKit). To draw with TextKit, just create a stack text set by setting whatever method you like, and then when it comes time to draw, call the layout manager drawBackgroundForGlyphRange:... and drawGlyphsForGlyphRange:...

+7
source share

All Articles