2

I'm looking at TextKit and every tutorial I've come across gives me the same information:

NSTextStorage holds your string and font information, NSLayoutManager manages layout and glyphs, and NSTextContainer specifies areas that the text should be drawn to.

Then, the next step is always UITextView. What if I want to draw the glyphs myself? How might I go about doing that? How does UITextView do it? Do I need to drop down to Core Text?

Moshe
  • 57,511
  • 78
  • 272
  • 425

1 Answers1

1

It turns out that NSLayoutManager has some handy drawing methods that you can use. The documentation describes them. The simplest one is drawBackgroundForGlyphRange(_:atPoint:) which draws into a text container.

Moshe
  • 57,511
  • 78
  • 272
  • 425