MDCTextField

@interface MDCTextField : UITextField <MDCTextInput, MDCLeadingViewTextInput,
                                       MDCElevatable, MDCElevationOverriding>

Material Design compliant single-line text input. https://www.google.com/design/spec/components/text-fields.html#text-fields-single-line-text-field

  • MDCTextField does not implement borders that conform to UITextBorderStyle.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) UITextBorderStyle borderStyle;
  • This label should always have the same layout as the input field (which is private API.)

    Unfortunately the included private baseline strut (which is the label returned for baseline-based auto layout) has bugs that keep it from matching custom layout. We recreate it but also allow it to have a width in case someone needs other kinds of auto layout constraints based off the input.

    It always has an alpha of 0.0.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nonnull) UILabel *inputLayoutStrut;
  • An overlay view on the leading side.

    Note: if RTL is engaged, this will return the .rightView and if LTR, it will return the .leftView.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable) UIView *leadingView;
  • Controls when the leading view will display.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) UITextFieldViewMode leadingViewMode;
  • A block that is invoked when the @c MDCTextField receives a call to @c traitCollectionDidChange:. The block is called after the call to the superclass.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) void (^)
        (MDCTextField *_Nonnull, UITraitCollection *_Nullable)
            traitCollectionDidChangeBlock;