Post

Replies

Boosts

Views

Activity

How to implement UITextItem in custom text view with UITextInput and TextKit2
Hi Apple, I'm implementing a custom text view by conforming to UITextInput and backing it with TextKit2. However, I like the UITextItem feature of the default UITextView. Can I get some guidance on how to reimplement it? Are we looking at overlaying UIMenu buttons? Or some API where I can display a UIMenu at a rect I specify? Hopefully, it is not some kind of private API? Thanks for the help in advance.
1
0
393
Jul ’24
What is the designated way to do custom background drawing in TextKit 2 when using UITextView/NSTextView?
In TextKit 1, I can override drawBackground(forGlyphRange:at:) in NSLayoutManager to do custom background drawing. However, I'm not too sure what the designated way of doing background drawing is in TextKit 2. One thing I've tried is to do custom drawing in my own CALayer that's used in the configureRenderingSurface delegate callback, but I'm unsure if we are suppose to use this API and steal the textViewportLayoutController.delegate away from _UITextLayoutcanvasView?
3
0
2.2k
Jun ’22
UITextView + TextKit 2: Are we allowed to configure our own custom rendering surface when using UITextView?
Hi TextKit 2 Team, I'm trying to configure my own custom rendering surface when using UITextView(usingTextLayoutManager: true). What I'm currently doing is adding a "contentLayer: CALayer" into my UITextView and adding my rendering surfaces into that. The issue I'm running into, is that the rendering surface will display the first character I input, but then will not update for subsequent text until: It becomes long enough to cause a line wrap. I hit return. Not sure if I'm doing something wrong? So my questions are: Is using configureRenderingSurface API intended to be used when I'm using UITextView? Or it's only meant for when I do fully custom InputView? Should I be inserting my rendering surfaces into my contentLayer or is there some more appropriate place for me to insert into? How do I properly trigger redraw or invalidation of my rendering surface on text editing changes? Is this a bug or do I have to trigger an update manually somewhere? Many thanks in advance!
0
0
1.1k
Jun ’22