Package apple.uikit.protocol
Interface UIScribbleInteractionDelegate
-
public interface UIScribbleInteractionDelegate
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default voidscribbleInteractionDidFinishWriting(UIScribbleInteraction interaction)Will be called when the user finished writing into the interaction's view, after the last word has been transcribed and committed.default booleanscribbleInteractionShouldBeginAtLocation(UIScribbleInteraction interaction, CGPoint location)Allows the delegate to prevent Scribble from starting at a specific location in the view.default booleanscribbleInteractionShouldDelayFocus(UIScribbleInteraction interaction)Allow the delegate to delay focusing (making first responder) the text input view.default voidscribbleInteractionWillBeginWriting(UIScribbleInteraction interaction)Will be called when the user begins writing into the interaction's view.
-
-
-
Method Detail
-
scribbleInteractionShouldBeginAtLocation
default boolean scribbleInteractionShouldBeginAtLocation(UIScribbleInteraction interaction, CGPoint location)
Allows the delegate to prevent Scribble from starting at a specific location in the view. If not implemented, defaults to YES. You can use this callback to temporarily suppress Scribble in text input views if your app supports drawing over text or other special interaction when using Apple Pencil. In cases like this, it's recommended to provide a UI affordance for the user to toggle between drawing and handwriting. This callback can also return NO for views that handle Pencil events directly, like a drawing canvas, since nearby text fields could take over the Pencil events for writing.- Parameters:
interaction- The interaction asking if it can begin handling user input.location- The location in the interaction's view coordinate system.- Returns:
- Return NO to disallow writing at the specified location.
-
scribbleInteractionDidFinishWriting
default void scribbleInteractionDidFinishWriting(UIScribbleInteraction interaction)
Will be called when the user finished writing into the interaction's view, after the last word has been transcribed and committed.- Parameters:
interaction- The interaction notifying about writing state changes.
-
scribbleInteractionShouldDelayFocus
default boolean scribbleInteractionShouldDelayFocus(UIScribbleInteraction interaction)
Allow the delegate to delay focusing (making first responder) the text input view. Normally, Scribble will focus the target input as soon as the user begins writing, but if you return YES from this callback, it will wait until the user makes a brief pause. This is useful in cases where the text input view will shift or transform when becoming first responder, which can be disruptive to a user trying to handwrite into it. Wherever possible it is preferable to adjust the UI behavior to avoid the layout changes, and only use delayed focus as a last resort, since transcription will happen all at once instead of incrementally.- Parameters:
interaction- The interaction asking about delaying focus.- Returns:
- Return YES to delay focusing the text input.
-
scribbleInteractionWillBeginWriting
default void scribbleInteractionWillBeginWriting(UIScribbleInteraction interaction)
Will be called when the user begins writing into the interaction's view. This call will always be paired with a corresponding call to scribbleInteractionDidFinishWriting:. It is recommended to use this call to hide custom placeholders or other UI elements that can interfere with writing.- Parameters:
interaction- The interaction notifying about writing state changes.
-
-