Interface UITextInput

    • 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.
      • 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
      • 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