Protocols

The following protocols are available globally.

  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol MDCMultilineTextInputDelegate <NSObject>
    
    @optional
    
    /**
     Called when the clear button is tapped.
    
     Return YES to set the textfield's .text to nil.
     Return NO to ignore and keep the .text.
    
     A direct mirror of UITextFieldDelegate's textFieldShouldClear:.
    
     UITextView's don't require this method already because they do not have clear buttons. The clear
     button in MDCMultilineTextField is custom.
     */
    - (BOOL)multilineTextFieldShouldClear:(UIView<MDCTextInput> *)textField;
    
    @end
  • MDCTextInputPositioningDelegate allows objects outside an MDCTextInput, like MDCTextInputController, to pass the MDCTextInput important layout information.

    Usually, these methods are direct mirrors of internal methods with the addition of a default value.

    See more

    Declaration

    Objective-C

    @protocol MDCTextInputPositioningDelegate <NSObject>
  • Common API for Material Design compliant text inputs.

    See more

    Declaration

    Objective-C

    @protocol MDCTextInput <NSObject>
  • Common API for text inputs that support having a leading view.

    MDCTextField implements this protocol but MDCMultilineTextField does not because the designers determined multiline text fields should only have trailing views.

    See more

    Declaration

    Objective-C

    @protocol MDCLeadingViewTextInput <MDCTextInput>
  • Common API for Material Design compliant multi-line text inputs.

    See more

    Declaration

    Objective-C

    @protocol MDCMultilineTextInput <MDCTextInput>
  • Protocol for custom character counters.

    Instead of relying on the default character count which is naive (counts each character regardless of context), this object can instead choose to do sophisticated counting (ie: ignoring whitespace, ignoring url strings, ignoring usernames, etc).

    See more

    Declaration

    Objective-C

    @protocol MDCTextInputCharacterCounter <NSObject>