How to split long NSString into pages

后端 未结 1 1919
抹茶落季
抹茶落季 2020-12-05 12:05

I have a long NSString I want to display over a couple of pages.

But to do this, I need to find out how much text will actually fit on the page.

[NSString si

相关标签:
1条回答
  • 2020-12-05 12:30

    You should look into CoreText, available since iOS 3.2. The docs are rather complicated and can be found here. Basically you create a CTFramesetter and call CTFramesetterSuggestFrameSizeWithConstraints. You will then find the range of text that fits within a given CGSize.

    0 讨论(0)
提交回复
热议问题