I'm trying to unpack this sentence
Note that after adding a second text container to the layout manager, the text views become uneditable and unselectable.
Found on this example code:
https://developer.apple.com/documentation/uikit/textkit/display_text_with_a_custom_layout
I'm implementing my own UITextInput which makes use of the example code setup to replicate a multi-page text editor (kind of like a basic version of Pages/Word)
Each page has its own NSTextContainer
which gets added to one NSLayoutManager
.
The code works and my views are rendering text across each page, however, only the first text view is editable.
It appears this is "by design" (?)
How do we get around this? Is there another level we have to drop down to enable multiple editing containers?
The sample code is wayback in iOS 13, so it would seem very odd if the capability of multiple editable text fields/containers was impossible to achieve.
The sample code is wayback in iOS 13, so it would seem very odd if the capability of multiple editable text fields/containers was impossible to achieve.
At the time of the sample code writing, that's a limitation in TextKit. I agree though that's something to be improved, and so please feel free to file a feedback report (http://developer.apple.com/bug-reporting/) to see if the TextKit folks have something to say – If you do so, please share your report ID here.
Worth mentioning though, the Text technology has been evolving to TextKit 2 for years. You are doing a new development, and so might consider adopting TextKit2, which will make your development better future-proof.
To get started with TextKit 2, see Meet TextKit 2.
Best,
——
Ziqiao Chen
Worldwide Developer Relations.