UITextViewDelegate

Trait UITextViewDelegate 

Source
pub unsafe trait UITextViewDelegate:
    NSObjectProtocol
    + UIScrollViewDelegate
    + MainThreadOnly {
Show 28 methods // Provided methods fn textViewShouldBeginEditing(&self, text_view: &UITextView) -> bool where Self: Sized + Message { ... } fn textViewShouldEndEditing(&self, text_view: &UITextView) -> bool where Self: Sized + Message { ... } fn textViewDidBeginEditing(&self, text_view: &UITextView) where Self: Sized + Message { ... } fn textViewDidEndEditing(&self, text_view: &UITextView) where Self: Sized + Message { ... } fn textView_shouldChangeTextInRange_replacementText( &self, text_view: &UITextView, range: NSRange, text: &NSString, ) -> bool where Self: Sized + Message { ... } fn textView_shouldChangeTextInRanges_replacementText( &self, text_view: &UITextView, ranges: &NSArray<NSValue>, text: &NSString, ) -> bool where Self: Sized + Message { ... } fn textViewDidChange(&self, text_view: &UITextView) where Self: Sized + Message { ... } fn textViewDidChangeSelection(&self, text_view: &UITextView) where Self: Sized + Message { ... } fn textView_editMenuForTextInRange_suggestedActions( &self, text_view: &UITextView, range: NSRange, suggested_actions: &NSArray<UIMenuElement>, ) -> Option<Retained<UIMenu>> where Self: Sized + Message { ... } fn textView_editMenuForTextInRanges_suggestedActions( &self, text_view: &UITextView, ranges: &NSArray<NSValue>, suggested_actions: &NSArray<UIMenuElement>, ) -> Option<Retained<UIMenu>> where Self: Sized + Message { ... } fn textView_willPresentEditMenuWithAnimator( &self, text_view: &UITextView, animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>, ) where Self: Sized + Message { ... } fn textView_willDismissEditMenuWithAnimator( &self, text_view: &UITextView, animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>, ) where Self: Sized + Message { ... } fn textView_primaryActionForTextItem_defaultAction( &self, text_view: &UITextView, text_item: &UITextItem, default_action: &UIAction, ) -> Option<Retained<UIAction>> where Self: Sized + Message { ... } fn textView_menuConfigurationForTextItem_defaultMenu( &self, text_view: &UITextView, text_item: &UITextItem, default_menu: &UIMenu, ) -> Option<Retained<UITextItemMenuConfiguration>> where Self: Sized + Message { ... } fn textView_textItemMenuWillDisplayForTextItem_animator( &self, text_view: &UITextView, text_item: &UITextItem, animator: &ProtocolObject<dyn UIContextMenuInteractionAnimating>, ) where Self: Sized + Message { ... } fn textView_textItemMenuWillEndForTextItem_animator( &self, text_view: &UITextView, text_item: &UITextItem, animator: &ProtocolObject<dyn UIContextMenuInteractionAnimating>, ) where Self: Sized + Message { ... } fn textViewWritingToolsWillBegin(&self, text_view: &UITextView) where Self: Sized + Message { ... } fn textViewWritingToolsDidEnd(&self, text_view: &UITextView) where Self: Sized + Message { ... } fn textView_writingToolsIgnoredRangesInEnclosingRange( &self, text_view: &UITextView, enclosing_range: NSRange, ) -> Retained<NSArray<NSValue>> where Self: Sized + Message { ... } fn textView_shouldInteractWithURL_inRange_interaction( &self, text_view: &UITextView, url: &NSURL, character_range: NSRange, interaction: UITextItemInteraction, ) -> bool where Self: Sized + Message { ... } fn textView_shouldInteractWithTextAttachment_inRange_interaction( &self, text_view: &UITextView, text_attachment: &NSTextAttachment, character_range: NSRange, interaction: UITextItemInteraction, ) -> bool where Self: Sized + Message { ... } fn textView_shouldInteractWithURL_inRange( &self, text_view: &UITextView, url: &NSURL, character_range: NSRange, ) -> bool where Self: Sized + Message { ... } fn textView_shouldInteractWithTextAttachment_inRange( &self, text_view: &UITextView, text_attachment: &NSTextAttachment, character_range: NSRange, ) -> bool where Self: Sized + Message { ... } fn textView_willBeginFormattingWithViewController( &self, text_view: &UITextView, view_controller: &UITextFormattingViewController, ) where Self: Sized + Message { ... } fn textView_didBeginFormattingWithViewController( &self, text_view: &UITextView, view_controller: &UITextFormattingViewController, ) where Self: Sized + Message { ... } fn textView_willEndFormattingWithViewController( &self, text_view: &UITextView, view_controller: &UITextFormattingViewController, ) where Self: Sized + Message { ... } fn textView_didEndFormattingWithViewController( &self, text_view: &UITextView, view_controller: &UITextFormattingViewController, ) where Self: Sized + Message { ... } fn textView_insertInputSuggestion( &self, text_view: &UITextView, input_suggestion: &UIInputSuggestion, ) where Self: Sized + Message { ... }
}
Available on crate features UIScrollView and UITextView only.
Expand description

Provided Methods§

Source

fn textViewShouldBeginEditing(&self, text_view: &UITextView) -> bool
where Self: Sized + Message,

Available on crate features UIResponder and UIView only.
Source

fn textViewShouldEndEditing(&self, text_view: &UITextView) -> bool
where Self: Sized + Message,

Available on crate features UIResponder and UIView only.
Source

fn textViewDidBeginEditing(&self, text_view: &UITextView)
where Self: Sized + Message,

Available on crate features UIResponder and UIView only.
Source

fn textViewDidEndEditing(&self, text_view: &UITextView)
where Self: Sized + Message,

Available on crate features UIResponder and UIView only.
Source

fn textView_shouldChangeTextInRange_replacementText( &self, text_view: &UITextView, range: NSRange, text: &NSString, ) -> bool
where Self: Sized + Message,

👎Deprecated
Available on crate features UIResponder and UIView only.
Source

fn textView_shouldChangeTextInRanges_replacementText( &self, text_view: &UITextView, ranges: &NSArray<NSValue>, text: &NSString, ) -> bool
where Self: Sized + Message,

Available on crate features UIResponder and UIView only.

Asks the delegate if the text at the specified ranges should be replaced with text.

If this method returns YES then the text view will, at its own discretion, choose any one of the specified ranges of text and replace it with the specified replacementText before deleting the text at the other ranges. If the delegate does not implement this method then the textView:shouldChangeTextInRange:replacementText: method will be called and passed the union range instead. If the delegate also does not implement that method then YES is assumed.

Parameter textView: The text view asking the delegate

Parameter ranges: The ranges of the text that should be deleted before replacing

Parameter replacementText: The replacement text

Returns: Returns true if the text at the ranges should be replaced.

Source

fn textViewDidChange(&self, text_view: &UITextView)
where Self: Sized + Message,

Available on crate features UIResponder and UIView only.
Source

fn textViewDidChangeSelection(&self, text_view: &UITextView)
where Self: Sized + Message,

Available on crate features UIResponder and UIView only.
Source

fn textView_editMenuForTextInRange_suggestedActions( &self, text_view: &UITextView, range: NSRange, suggested_actions: &NSArray<UIMenuElement>, ) -> Option<Retained<UIMenu>>
where Self: Sized + Message,

👎Deprecated
Available on crate features UIMenu and UIMenuElement and UIResponder and UIView only.

Asks the delegate for the menu to be shown for the specified text range.

Parameter textView: The text view requesting the menu.

Parameter range: The text range for which the menu is presented for.

Parameter suggestedActions: The actions and commands that the system suggests.

Returns: Return a UIMenu describing the desired menu hierarchy. Return nilto present the default system menu.

Source

fn textView_editMenuForTextInRanges_suggestedActions( &self, text_view: &UITextView, ranges: &NSArray<NSValue>, suggested_actions: &NSArray<UIMenuElement>, ) -> Option<Retained<UIMenu>>
where Self: Sized + Message,

Available on crate features UIMenu and UIMenuElement and UIResponder and UIView only.

Asks the delegate for the menu to be shown for the specified text ranges.

If the delegate does not implement this method then the textView:editMenuForTextInRange:suggestedActions: method will be called and passed the union range instead. If the delegate also does not implement that method then nil is assumed.

Parameter textView: The text view requesting the menu.

Parameter ranges: The text ranges for which the menu is presented for.

Parameter suggestedActions: The actions and commands that the system suggests.

Returns: Return a UIMenu describing the desired menu hierarchy. Return nilto present the default system menu.

Source

fn textView_willPresentEditMenuWithAnimator( &self, text_view: &UITextView, animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>, )
where Self: Sized + Message,

Available on crate features UIEditMenuInteraction and UIResponder and UIView only.

Called when the text view is about to present the edit menu.

Parameter textView: The text view displaying the menu.

Parameter animator: Appearance animator. Add animations to this object to run them alongside the appearance transition.

Source

fn textView_willDismissEditMenuWithAnimator( &self, text_view: &UITextView, animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>, )
where Self: Sized + Message,

Available on crate features UIEditMenuInteraction and UIResponder and UIView only.

Called when the text view is about to dismiss the edit menu.

Parameter textView: The text view displaying the menu.

Parameter animator: Dismissal animator. Add animations to this object to run them alongside the dismissal transition.

Source

fn textView_primaryActionForTextItem_defaultAction( &self, text_view: &UITextView, text_item: &UITextItem, default_action: &UIAction, ) -> Option<Retained<UIAction>>
where Self: Sized + Message,

Available on crate features UIAction and UIMenuElement and UIResponder and UITextItem and UIView only.

Asks the delegate for the action to be performed when interacting with a text item. If a nil action is provided, the text view will request a menu to be presented on primary action if possible.

Parameter textView: The text view requesting the primary action.

Parameter textItem: The text item for performing said action.

Parameter defaultAction: The default action for the text item. Return this to perform the default action.

Returns: Return a UIAction to be performed when the text item is interacted with. Return nilto prevent the action from being performed.

Source

fn textView_menuConfigurationForTextItem_defaultMenu( &self, text_view: &UITextView, text_item: &UITextItem, default_menu: &UIMenu, ) -> Option<Retained<UITextItemMenuConfiguration>>
where Self: Sized + Message,

Available on crate features UIMenu and UIMenuElement and UIResponder and UITextItem and UIView only.

Asks the delegate for the menu configuration to be performed when interacting with a text item.

Parameter textView: The text view requesting the menu.

Parameter textItem: The text item for performing said action.

Parameter defaultMenu: The default menu for the specified text item.

Returns: Return a menu configuration to be presented when the text item is interacted with. Return nilto prevent the menu from being presented.

Source

fn textView_textItemMenuWillDisplayForTextItem_animator( &self, text_view: &UITextView, text_item: &UITextItem, animator: &ProtocolObject<dyn UIContextMenuInteractionAnimating>, )
where Self: Sized + Message,

Available on crate features UIContextMenuInteraction and UIResponder and UITextItem and UIView only.

Informs the delegate that a text item menu is about to be presented with the specified animator.

Parameter textView: The text view showing the menu.

Parameter textItem: The text item for performing said action.

Parameter animator: Appearance animator. Add animations to this object to run them alongside the appearance transition.

Source

fn textView_textItemMenuWillEndForTextItem_animator( &self, text_view: &UITextView, text_item: &UITextItem, animator: &ProtocolObject<dyn UIContextMenuInteractionAnimating>, )
where Self: Sized + Message,

Available on crate features UIContextMenuInteraction and UIResponder and UITextItem and UIView only.

Informs the delegate that a text item menu is about to be dismissed with the specified animator.

Parameter textView: The text view showing the menu.

Parameter textItem: The text item for performing said action.

Parameter animator: Dismissal animator. Add animations to this object to run them alongside the dismissal transition.

Source

fn textViewWritingToolsWillBegin(&self, text_view: &UITextView)
where Self: Sized + Message,

Available on crate features UIResponder and UIView only.

Informs the delegate that Writing Tools will begin manipulating the text view

Parameter textView: The text view interacting with Writing Tools

Source

fn textViewWritingToolsDidEnd(&self, text_view: &UITextView)
where Self: Sized + Message,

Available on crate features UIResponder and UIView only.

Informs the delegate that Writing Tools has finished manipulating the text view

Parameter textView: The text view interacting with Writing Tools

Source

fn textView_writingToolsIgnoredRangesInEnclosingRange( &self, text_view: &UITextView, enclosing_range: NSRange, ) -> Retained<NSArray<NSValue>>
where Self: Sized + Message,

Available on crate features UIResponder and UIView only.

Allows the delegate to specify ranges of text to be ignored by Writing Tools

Parameter textView: The text view interacting with Writing Tools

Parameter enclosingRange:

Returns: Return an array of ranges in the attributed substring of the textView storage with the enclosing range representing portions of text to be ignored by Writing Tools when evaluating the text for proofreading, summarization, rewrites, and so forth.

Source

fn textView_shouldInteractWithURL_inRange_interaction( &self, text_view: &UITextView, url: &NSURL, character_range: NSRange, interaction: UITextItemInteraction, ) -> bool
where Self: Sized + Message,

👎Deprecated: Replaced by primaryActionForTextItem: and menuConfigurationForTextItem: for additional customization options.
Available on crate features UIResponder and UITextItemInteraction and UIView only.
Source

fn textView_shouldInteractWithTextAttachment_inRange_interaction( &self, text_view: &UITextView, text_attachment: &NSTextAttachment, character_range: NSRange, interaction: UITextItemInteraction, ) -> bool
where Self: Sized + Message,

👎Deprecated: Replaced by primaryActionForTextItem: and menuConfigurationForTextItem: for additional customization options.
Available on crate features NSTextAttachment and UIResponder and UITextItemInteraction and UIView only.
Source

fn textView_shouldInteractWithURL_inRange( &self, text_view: &UITextView, url: &NSURL, character_range: NSRange, ) -> bool
where Self: Sized + Message,

👎Deprecated
Available on crate features UIResponder and UIView only.
Source

fn textView_shouldInteractWithTextAttachment_inRange( &self, text_view: &UITextView, text_attachment: &NSTextAttachment, character_range: NSRange, ) -> bool
where Self: Sized + Message,

👎Deprecated
Available on crate features NSTextAttachment and UIResponder and UIView only.
Source

fn textView_willBeginFormattingWithViewController( &self, text_view: &UITextView, view_controller: &UITextFormattingViewController, )
where Self: Sized + Message,

Available on crate features UIResponder and UITextFormattingViewController and UIView and UIViewController only.

Informs the delegate that text formatting controller is about to be presented.

Parameter viewController: The text formatting controller that is being presented.

Source

fn textView_didBeginFormattingWithViewController( &self, text_view: &UITextView, view_controller: &UITextFormattingViewController, )
where Self: Sized + Message,

Available on crate features UIResponder and UITextFormattingViewController and UIView and UIViewController only.

Informs the delegate that text formatting controller has been presented.

Parameter viewController: The text formatting controller that is being presented.

Source

fn textView_willEndFormattingWithViewController( &self, text_view: &UITextView, view_controller: &UITextFormattingViewController, )
where Self: Sized + Message,

Available on crate features UIResponder and UITextFormattingViewController and UIView and UIViewController only.

Informs the delegate that text formatting controller is about to be dismissed.

Parameter viewController: The text formatting controller that is being presented.

Source

fn textView_didEndFormattingWithViewController( &self, text_view: &UITextView, view_controller: &UITextFormattingViewController, )
where Self: Sized + Message,

Available on crate features UIResponder and UITextFormattingViewController and UIView and UIViewController only.

Informs the delegate that text formatting controller has been dismissed.

Parameter viewController: The text formatting controller that is being presented.

Source

fn textView_insertInputSuggestion( &self, text_view: &UITextView, input_suggestion: &UIInputSuggestion, )
where Self: Sized + Message,

Available on crate features UIInputSuggestion and UIResponder and UIView only.

Tells the delegate when the keyboard delivers an input suggestion.

  • Parameters:
  • textView: The text view that is currently the first responder.
  • inputSuggestion: The input suggestion that the user or system selected.

Trait Implementations§

Source§

impl ProtocolType for dyn UITextViewDelegate

Source§

const NAME: &'static str = "UITextViewDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn UITextViewDelegate

Implementations on Foreign Types§

Source§

impl<T> UITextViewDelegate for ProtocolObject<T>

Implementors§