My app displays vertically scrollable text to the user which could be as short as a single screen or as long as a book chapter: imagine something like an e-book reader which uses scrolling rather than page-turning.
A long time ago when development first started, I tried using UITextView, but the size of text that could be handled was quite limited (a figure of 32767 points seems to stick in the memory). Accordingly I came up with a custom solution in which a UIScrollView handled scrolling gestures and a custom UIView rendered just the part of the text that was visible at that time. That works, but it becomes cumbersome to add support for features such as selection handles and loupes.
18 years later, is there a more smoothly integrated way of displaying long scrollable text?
Hi!
UITextView has come a long way, and uses the viewport based virtual scrolling mechanism provided by TextKit. You can take a look at these WWDC sessions to learn more about it.
- https://developer.apple.com/videos/play/wwdc2021/10061/
- https://developer.apple.com/videos/play/wwdc2022/10090/
- https://developer.apple.com/videos/play/wwdc2026/370/
-- Tarun