Insertion point when delaying focus of UIIndirectScribbleInteraction

Hi there,

I'm currently playing around with Scribble and ran into an odd behavior.

Let's say I have an app where I can scribble on a canvas. After scribble has finished, a custom view with a textView should appear and the scribbled text should be forwarded to the textView. Depending on where I wrote on the canvas, additional info is forwarded to the view and put in as a prefix for the textView. That at least was the idea.

To implement this, I've added a UIIndirectScribbleInteraction to the canvas and implemented the UIIndirectScribbleInteractionDelegate. When the focus is requested through indirectScribbleInteraction:focusElementIfNeeded:referencePoint:completion:, I bring up the custom view, insert the prefix based on the referencePoint into the textView, make it become firstResponder and hand over the textView in the completion block.

Now since the appearance of that custom view is pretty disruptive, I return true for indirectScribbleInteraction:shouldDelayFocusForElement:. And here is where the problem starts. As soon as I do that, the scribble input is always inserted at the start of the textView, so in front of my prefix. If I do not delay the focus and insert my prefix, the scribble input is correctly appended after the prefix.

I do not fully understand why delaying the focus should change the behavior here. Scribble always only gets to know the target textView through calling the completion of indirectScribbleInteraction:focusElementIfNeeded:referencePoint:completion:, and before completion is called, the prefix is inserted. So I feel like scribble should be able to see that there is already text inside that textView and append its text, instead of inserting it into the front.

I would welcome any clarification on my issue :)

Thanks,
Klemens

Accepted Reply

Hi Klemens. There should be no difference in behavior about the initial insertion point when delaying focus.
If you think you might be hitting a bug in the system, could you please send a report through the Feedback Assistant? If possible, please include a simple Xcode project that simulates your scenario and reproduces the issue.
Thanks.

Replies

Hi Klemens. There should be no difference in behavior about the initial insertion point when delaying focus.
If you think you might be hitting a bug in the system, could you please send a report through the Feedback Assistant? If possible, please include a simple Xcode project that simulates your scenario and reproduces the issue.
Thanks.
Done - Thanks!
FB8376788