Package apple.uikit.protocol
Interface UITextInput
-
- All Superinterfaces:
UIKeyInput,UITextInputTraits
- All Known Subinterfaces:
UITextDraggable,UITextDroppable
- All Known Implementing Classes:
UISearchTextField,UITextField,UITextView
public interface UITextInput extends UIKeyInput
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description longbaseWritingDirectionForPositionInDirection(@NotNull UITextPosition position, long direction)Writing directiondefault voidbeginFloatingCursorAtPoint(CGPoint point)The following three optional methods are for clients that wish to display a floating cursor to guide user manipulation of the selected text range via the system-provided keyboard.@NotNull UITextPositionbeginningOfDocument()The end and beginning of the the text document.CGRectcaretRectForPosition(@NotNull UITextPosition position)default longcharacterOffsetOfPositionWithinRange(@NotNull UITextPosition position, @NotNull UITextRange range)@Nullable UITextRangecharacterRangeAtPoint(CGPoint point)@Nullable UITextRangecharacterRangeByExtendingPositionInDirection(@NotNull UITextPosition position, long direction)@Nullable UITextPositionclosestPositionToPoint(CGPoint point)Hit testing.@Nullable UITextPositionclosestPositionToPointWithinRange(CGPoint point, @NotNull UITextRange range)longcomparePositionToPosition(@NotNull UITextPosition position, @NotNull UITextPosition other)Simple evaluation of positionsdefault voiddictationRecognitionFailed()default voiddictationRecordingDidEnd()These are optional methods for clients that wish to know when there are pending dictation results.default @Nullable UIMenueditMenuForTextRangeSuggestedActions(@NotNull UITextRange textRange, @NotNull NSArray<? extends UIMenuElement> suggestedActions)Called when the text input is preparing an edit menu presentation for the specified text range.default voidendFloatingCursor()API-Since: 9.0@NotNull UITextPositionendOfDocument()CGRectfirstRectForRange(@NotNull UITextRange range)Geometry used to provide, for example, a correction rect.default CGRectframeForDictationResultPlaceholder(@NotNull java.lang.Object placeholder)@Nullable UITextInputDelegateinputDelegate()A system-provided input delegate is assigned when the system is interested in input changes.default voidinsertDictationResult(@NotNull NSArray<? extends UIDictationPhrase> dictationResult)This is an optional method for clients that wish to support dictation phrase alternatives.default @NotNull java.lang.ObjectinsertDictationResultPlaceholder()The following three optional methods are for clients that wish to support a placeholder for pending dictation results.default voidinsertTextAlternativesStyle(@NotNull java.lang.String text, @NotNull NSArray<java.lang.String> alternatives, long style)This is an optional method for clients that wish to support text phrase alternatives.default @NotNull UITextPlaceholderinsertTextPlaceholderWithSize(CGSize size)Insert a placeholder If `size.height` is <= 0, then the placeholder is inline and line height.@Nullable UITextRangemarkedTextRange()Nil if no marked text.@Nullable NSDictionary<java.lang.String,?>markedTextStyle()Describes how the marked text should be drawn.longoffsetFromPositionToPosition(@NotNull UITextPosition from, @NotNull UITextPosition toPosition)@Nullable UITextPositionpositionFromPositionInDirectionOffset(@NotNull UITextPosition position, long direction, long offset)@Nullable UITextPositionpositionFromPositionOffset(@NotNull UITextPosition position, long offset)default @Nullable UITextPositionpositionWithinRangeAtCharacterOffset(@NotNull UITextRange range, long offset)To be implemented if there is not a one-to-one correspondence between text positions within range and character offsets into the associated string.@Nullable UITextPositionpositionWithinRangeFarthestInDirection(@NotNull UITextRange range, long direction)Layout questions.default voidremoveDictationResultPlaceholderWillInsertResult(@NotNull java.lang.Object placeholder, boolean willInsertResult)willInsertResult will be NO if the recognition failed.default voidremoveTextPlaceholder(@NotNull UITextPlaceholder textPlaceholder)Remove the placeholder.voidreplaceRangeWithText(@NotNull UITextRange range, @NotNull java.lang.String text)@Nullable UITextRangeselectedTextRange()Text may have a selection, either zero-length (a caret) or ranged.default longselectionAffinity()Selection affinity determines whether, for example, the insertion point appears after the last character on a line or before the first character on the following line in cases where text wraps across line boundaries.@NotNull NSArray<? extends UITextSelectionRect>selectionRectsForRange(@NotNull UITextRange range)Returns an array of UITextSelectionRects API-Since: 6.0default voidsetAttributedMarkedTextSelectedRange(@Nullable NSAttributedString markedText, NSRange selectedRange)set attributedString as markedText, selectedRange is a range within the markedTextvoidsetBaseWritingDirectionForRange(long writingDirection, @NotNull UITextRange range)voidsetInputDelegate_unsafe(@Nullable UITextInputDelegate value)A system-provided input delegate is assigned when the system is interested in input changes.voidsetMarkedTextSelectedRange(@Nullable java.lang.String markedText, NSRange selectedRange)selectedRange is a range within the markedTextvoidsetMarkedTextStyle(@Nullable NSDictionary<java.lang.String,?> value)Describes how the marked text should be drawn.voidsetSelectedTextRange(@Nullable UITextRange value)Text may have a selection, either zero-length (a caret) or ranged.default voidsetSelectionAffinity(long value)Selection affinity determines whether, for example, the insertion point appears after the last character on a line or before the first character on the following line in cases where text wraps across line boundaries.default booleanshouldChangeTextInRangeReplacementText(@NotNull UITextRange range, @NotNull java.lang.String text)return NO to not change text API-Since: 6.0default @NotNull UIViewtextInputView()An affiliated view that provides a coordinate system for all geometric values in this protocol.@Nullable java.lang.StringtextInRange(@NotNull UITextRange range)Methods for manipulating text.@Nullable UITextRangetextRangeFromPositionToPosition(@NotNull UITextPosition fromPosition, @NotNull UITextPosition toPosition)Methods for creating ranges and positions.default @Nullable NSDictionary<java.lang.String,?>textStylingAtPositionInDirection(@NotNull UITextPosition position, long direction)Text styling information can affect, for example, the appearance of a correction rect.@NotNull UITextInputTokenizertokenizer()A tokenizer must be provided to inform the text input system about text units of varying granularity.voidunmarkText()default voidupdateFloatingCursorAtPoint(CGPoint point)API-Since: 9.0default voidwillDismissEditMenuWithAnimator(@NotNull UIEditMenuInteractionAnimating animator)API-Since: 16.0default voidwillPresentEditMenuWithAnimator(@NotNull UIEditMenuInteractionAnimating animator)These are optional methods for clients that wish to know the visiblity of text editing menus API-Since: 16.0-
Methods inherited from interface apple.uikit.protocol.UIKeyInput
deleteBackward, hasText, insertText
-
Methods inherited from interface apple.uikit.protocol.UITextInputTraits
autocapitalizationType, autocorrectionType, enablesReturnKeyAutomatically, inlinePredictionType, isSecureTextEntry, keyboardAppearance, keyboardType, passwordRules, returnKeyType, setAutocapitalizationType, setAutocorrectionType, setEnablesReturnKeyAutomatically, setInlinePredictionType, setKeyboardAppearance, setKeyboardType, setPasswordRules, setReturnKeyType, setSecureTextEntry, setSmartDashesType, setSmartInsertDeleteType, setSmartQuotesType, setSpellCheckingType, setTextContentType, smartDashesType, smartInsertDeleteType, smartQuotesType, spellCheckingType, textContentType
-
-
-
-
Method Detail
-
baseWritingDirectionForPositionInDirection
long baseWritingDirectionForPositionInDirection(@NotNull @NotNull UITextPosition position, long direction)Writing direction
-
beginFloatingCursorAtPoint
default void beginFloatingCursorAtPoint(CGPoint point)
The following three optional methods are for clients that wish to display a floating cursor to guide user manipulation of the selected text range via the system-provided keyboard. If a client does not implement these methods, user feedback will be limited to the outcome after setting the selected text range using positions resulting from hit testing. API-Since: 9.0
-
beginningOfDocument
@NotNull @NotNull UITextPosition beginningOfDocument()
The end and beginning of the the text document.
-
caretRectForPosition
CGRect caretRectForPosition(@NotNull @NotNull UITextPosition position)
-
characterOffsetOfPositionWithinRange
default long characterOffsetOfPositionWithinRange(@NotNull @NotNull UITextPosition position, @NotNull @NotNull UITextRange range)
-
characterRangeAtPoint
@Nullable @Nullable UITextRange characterRangeAtPoint(CGPoint point)
-
characterRangeByExtendingPositionInDirection
@Nullable @Nullable UITextRange characterRangeByExtendingPositionInDirection(@NotNull @NotNull UITextPosition position, long direction)
-
closestPositionToPoint
@Nullable @Nullable UITextPosition closestPositionToPoint(CGPoint point)
Hit testing.
-
closestPositionToPointWithinRange
@Nullable @Nullable UITextPosition closestPositionToPointWithinRange(CGPoint point, @NotNull @NotNull UITextRange range)
-
comparePositionToPosition
long comparePositionToPosition(@NotNull @NotNull UITextPosition position, @NotNull @NotNull UITextPosition other)Simple evaluation of positions
-
dictationRecognitionFailed
default void dictationRecognitionFailed()
-
dictationRecordingDidEnd
default void dictationRecordingDidEnd()
These are optional methods for clients that wish to know when there are pending dictation results.
-
endFloatingCursor
default void endFloatingCursor()
API-Since: 9.0
-
endOfDocument
@NotNull @NotNull UITextPosition endOfDocument()
-
firstRectForRange
CGRect firstRectForRange(@NotNull @NotNull UITextRange range)
Geometry used to provide, for example, a correction rect.
-
frameForDictationResultPlaceholder
default CGRect frameForDictationResultPlaceholder(@NotNull @NotNull java.lang.Object placeholder)
-
inputDelegate
@Nullable @Nullable UITextInputDelegate inputDelegate()
A system-provided input delegate is assigned when the system is interested in input changes.
-
insertDictationResult
default void insertDictationResult(@NotNull @NotNull NSArray<? extends UIDictationPhrase> dictationResult)This is an optional method for clients that wish to support dictation phrase alternatives. If they do not implement this method, dictation will just insert the most likely interpretation of what was spoken via -insertText:. dictationResult is an array of UIDictationPhrases.
-
insertDictationResultPlaceholder
@NotNull default @NotNull java.lang.Object insertDictationResultPlaceholder()
The following three optional methods are for clients that wish to support a placeholder for pending dictation results. -insertDictationPlaceholder must return a reference to the placeholder. This reference will be used to identify the placeholder by the other methods (there may be more than one placeholder).
-
markedTextRange
@Nullable @Nullable UITextRange markedTextRange()
Nil if no marked text.
-
markedTextStyle
@Nullable @Nullable NSDictionary<java.lang.String,?> markedTextStyle()
Describes how the marked text should be drawn.
-
offsetFromPositionToPosition
long offsetFromPositionToPosition(@NotNull @NotNull UITextPosition from, @NotNull @NotNull UITextPosition toPosition)
-
positionFromPositionInDirectionOffset
@Nullable @Nullable UITextPosition positionFromPositionInDirectionOffset(@NotNull @NotNull UITextPosition position, long direction, long offset)
-
positionFromPositionOffset
@Nullable @Nullable UITextPosition positionFromPositionOffset(@NotNull @NotNull UITextPosition position, long offset)
-
positionWithinRangeAtCharacterOffset
@Nullable default @Nullable UITextPosition positionWithinRangeAtCharacterOffset(@NotNull @NotNull UITextRange range, long offset)
To be implemented if there is not a one-to-one correspondence between text positions within range and character offsets into the associated string.
-
positionWithinRangeFarthestInDirection
@Nullable @Nullable UITextPosition positionWithinRangeFarthestInDirection(@NotNull @NotNull UITextRange range, long direction)
Layout questions.
-
removeDictationResultPlaceholderWillInsertResult
default void removeDictationResultPlaceholderWillInsertResult(@NotNull @NotNull java.lang.Object placeholder, boolean willInsertResult)willInsertResult will be NO if the recognition failed.
-
replaceRangeWithText
void replaceRangeWithText(@NotNull @NotNull UITextRange range, @NotNull @NotNull java.lang.String text)
-
selectedTextRange
@Nullable @Nullable UITextRange selectedTextRange()
Text may have a selection, either zero-length (a caret) or ranged. Editing operations are always performed on the text from this selection. nil corresponds to no selection.
-
selectionAffinity
default long selectionAffinity()
Selection affinity determines whether, for example, the insertion point appears after the last character on a line or before the first character on the following line in cases where text wraps across line boundaries.
-
selectionRectsForRange
@NotNull @NotNull NSArray<? extends UITextSelectionRect> selectionRectsForRange(@NotNull @NotNull UITextRange range)
Returns an array of UITextSelectionRects API-Since: 6.0
-
setBaseWritingDirectionForRange
void setBaseWritingDirectionForRange(long writingDirection, @NotNull @NotNull UITextRange range)
-
setInputDelegate_unsafe
void setInputDelegate_unsafe(@Nullable @Nullable UITextInputDelegate value)A system-provided input delegate is assigned when the system is interested in input changes.
-
setMarkedTextSelectedRange
void setMarkedTextSelectedRange(@Nullable @Nullable java.lang.String markedText, NSRange selectedRange)selectedRange is a range within the markedText
-
setMarkedTextStyle
void setMarkedTextStyle(@Nullable @Nullable NSDictionary<java.lang.String,?> value)Describes how the marked text should be drawn.
-
setSelectedTextRange
void setSelectedTextRange(@Nullable @Nullable UITextRange value)Text may have a selection, either zero-length (a caret) or ranged. Editing operations are always performed on the text from this selection. nil corresponds to no selection.
-
setSelectionAffinity
default void setSelectionAffinity(long value)
Selection affinity determines whether, for example, the insertion point appears after the last character on a line or before the first character on the following line in cases where text wraps across line boundaries.
-
shouldChangeTextInRangeReplacementText
default boolean shouldChangeTextInRangeReplacementText(@NotNull @NotNull UITextRange range, @NotNull @NotNull java.lang.String text)return NO to not change text API-Since: 6.0
-
textInRange
@Nullable @Nullable java.lang.String textInRange(@NotNull @NotNull UITextRange range)Methods for manipulating text.
-
textInputView
@NotNull default @NotNull UIView textInputView()
An affiliated view that provides a coordinate system for all geometric values in this protocol. If unimplemented, the first view in the responder chain will be selected.
-
textRangeFromPositionToPosition
@Nullable @Nullable UITextRange textRangeFromPositionToPosition(@NotNull @NotNull UITextPosition fromPosition, @NotNull @NotNull UITextPosition toPosition)
Methods for creating ranges and positions.
-
textStylingAtPositionInDirection
@Nullable default @Nullable NSDictionary<java.lang.String,?> textStylingAtPositionInDirection(@NotNull @NotNull UITextPosition position, long direction)
Text styling information can affect, for example, the appearance of a correction rect. Returns a dictionary containing NSAttributedString keys.
-
tokenizer
@NotNull @NotNull UITextInputTokenizer tokenizer()
A tokenizer must be provided to inform the text input system about text units of varying granularity.
-
unmarkText
void unmarkText()
-
updateFloatingCursorAtPoint
default void updateFloatingCursorAtPoint(CGPoint point)
API-Since: 9.0
-
insertTextAlternativesStyle
default void insertTextAlternativesStyle(@NotNull @NotNull java.lang.String text, @NotNull @NotNull NSArray<java.lang.String> alternatives, long style)This is an optional method for clients that wish to support text phrase alternatives. If they do not implement this method, the text will be inserted by -insertText: without the phase alternatives.
-
insertTextPlaceholderWithSize
@NotNull default @NotNull UITextPlaceholder insertTextPlaceholderWithSize(CGSize size)
Insert a placeholder If `size.height` is <= 0, then the placeholder is inline and line height. If `size.height` is > 0, then the placeholder is treated as a paragraph of height `size.height`.
-
removeTextPlaceholder
default void removeTextPlaceholder(@NotNull @NotNull UITextPlaceholder textPlaceholder)Remove the placeholder.
-
setAttributedMarkedTextSelectedRange
default void setAttributedMarkedTextSelectedRange(@Nullable @Nullable NSAttributedString markedText, NSRange selectedRange)set attributedString as markedText, selectedRange is a range within the markedText
-
editMenuForTextRangeSuggestedActions
@Nullable default @Nullable UIMenu editMenuForTextRangeSuggestedActions(@NotNull @NotNull UITextRange textRange, @NotNull @NotNull NSArray<? extends UIMenuElement> suggestedActions)
Called when the text input is preparing an edit menu presentation for the specified text range.- Parameters:
textRange- The text range for which the menu is presented for.suggestedActions- The actions and commands that the system suggests.- Returns:
- Return a UIMenu describing the desired menu hierarchy. Return @c nil to present the default system menu. API-Since: 16.0
-
willDismissEditMenuWithAnimator
default void willDismissEditMenuWithAnimator(@NotNull @NotNull UIEditMenuInteractionAnimating animator)API-Since: 16.0
-
willPresentEditMenuWithAnimator
default void willPresentEditMenuWithAnimator(@NotNull @NotNull UIEditMenuInteractionAnimating animator)These are optional methods for clients that wish to know the visiblity of text editing menus API-Since: 16.0
-
-