MDCChipView

@interface MDCChipView : UIControl

/*
 A UIImageView that leads the title label.
 */
@property(nonatomic, readonly, nonnull) IBInspectable UIImageView *imageView;

/*
 A UIImageView that leads the title label. Appears in front of the imageView. Only visible when the
 chip is selected.

 This image view is typically used to show some icon that denotes the chip as selected, such as a
 check mark. If imageView has no image then the chip will require resizing when selected or
 deselected to account for the changing visibility of selectedImageView.
 */
@property(nonatomic, readonly, nonnull) IBInspectable UIImageView *selectedImageView;

/*
 A UIView that trails the title label.

 It will be given a size based on the value returned from sizeThatFits:.
 */
@property(nonatomic, strong, nullable) IBInspectable UIView *accessoryView;

/*
 The title label.

 @note The title color is controlled by setTitleColor:forState:.
 @note The title font is controlled by setTitleFont.
 */
@property(nonatomic, readonly, nonnull) IBInspectable UILabel *titleLabel;

/*
 Padding around the chip content. Each subview can be further padded with their invidual padding
 property.

 The chip uses this property to determine intrinsicContentSize and sizeThatFits.

 Defaults to (4, 4, 4, 4).
 */
@property(nonatomic, assign) UIEdgeInsets contentPadding UI_APPEARANCE_SELECTOR;

/*
 Padding around the image view. Only used if the image view has a non-nil image.

 The chip uses this property to determine intrinsicContentSize and sizeThatFits.

 Defaults to (0, 0, 0, 0).
 */
@property(nonatomic, assign) UIEdgeInsets imagePadding UI_APPEARANCE_SELECTOR;

/*
 Padding around the accessory view. Only used if the accessory view is non-nil.

 The chip uses this property to determine intrinsicContentSize and sizeThatFits.

 Defaults to (0, 0, 0, 0).
 */
@property(nonatomic, assign) UIEdgeInsets accessoryPadding UI_APPEARANCE_SELECTOR;

/*
 Padding around the title.

 The chip uses this property to determine intrinsicContentSize and sizeThatFits.

 Defaults to (3, 8, 4, 8). The top padding is shorter so the default height of a chip is 32 pts.
 */
@property(nonatomic, assign) UIEdgeInsets titlePadding UI_APPEARANCE_SELECTOR;

/*
 Font used to render the title.

 If nil, the chip will use the system font.
 */
@property(nonatomic, strong, nullable) UIFont *titleFont UI_APPEARANCE_SELECTOR;

/*
 This property determines if an @c MDCChipView should use the @c MDCRippleView behavior or not.
 By setting this property to @c YES, @c MDCStatefulRippleView is used to provide the user visual
 touch feedback, instead of the legacy @c MDCInkView.
 @note Defaults to @c NO.
 */
@property(nonatomic, assign) BOOL enableRippleBehavior;

/*
 The color of the ink ripple.
 */
@property(nonatomic, strong, null_resettable)
    UIColor *inkColor UI_APPEARANCE_SELECTOR __deprecated_msg("Use setInkColor:forState:");

/*
 The shape generator used to define the chip's shape.
 */
@property(nullable, nonatomic, strong) id<MDCShapeGenerating> shapeGenerator UI_APPEARANCE_SELECTOR;

/*
 Indicates whether the chip should automatically update its font when the device’s
 UIContentSizeCategory is changed.

 This property is modeled after the adjustsFontForContentSizeCategory property in the
 UIContentSizeCategoryAdjusting protocol added by Apple in iOS 10.0.

 If set to YES, this button will base its text font on MDCFontTextStyleButton.

 Default value is NO.
 */
@property(nonatomic, readwrite, setter=mdc_setAdjustsFontForContentSizeCategory:)
    BOOL mdc_adjustsFontForContentSizeCategory UI_APPEARANCE_SELECTOR;

/**
 The minimum dimensions of the Chip. A non-positive value for either height or width is equivalent
 to no minimum for that dimension.

 Defaults to a minimum height of 32 points, and no minimum width.
 */
@property(nonatomic, assign) CGSize minimumSize UI_APPEARANCE_SELECTOR;

/**
 Custom insets to use when computing touch targets. A positive inset value will shrink the hit
 area for the Chip.
 */
@property(nonatomic, assign) UIEdgeInsets hitAreaInsets;

/*
 A color used as the chip's @c backgroundColor for @c state.

 If no background color has been set for a given state, the returned value will fall back to the
 value set for UIControlStateNormal.

 @param state The control state.
 @return The background color.
 */
- (nullable UIColor *)backgroundColorForState:(UIControlState)state;

/*
 A color used as the chip's @c backgroundColor.

 Defaults to blue.

 @param backgroundColor The background color.
 @param state The control state.
 */
- (void)setBackgroundColor:(nullable UIColor *)backgroundColor
                  forState:(UIControlState)state UI_APPEARANCE_SELECTOR;

/*
 Returns the border color for a particular control state.

 If no border width has been set for a given state, the returned value will fall back to the value
 set for UIControlStateNormal.

 @param state The control state.
 @return The border color for the requested state.
 */
- (nullable UIColor *)borderColorForState:(UIControlState)state;

/*
 Sets the border color for a particular control state.

 @param borderColor The border color.
 @param state The control state.
 */
- (void)setBorderColor:(nullable UIColor *)borderColor
              forState:(UIControlState)state UI_APPEARANCE_SELECTOR;

/*
 Returns the border width for a particular control state.

 If no border width has been set for a given state, the returned value will fall back to the value
 set for UIControlStateNormal.

 @param state The control state.
 @return The border width for the requested state.
 */
- (CGFloat)borderWidthForState:(UIControlState)state;

/*
 Sets the border width for a particular control state.

 @param borderWidth The border width.
 @param state The control state.
 */
- (void)setBorderWidth:(CGFloat)borderWidth forState:(UIControlState)state UI_APPEARANCE_SELECTOR;

/*
 Returns the elevation for a particular control state.

 If no elevation has been set for a given state, the returned value will fall back to the value set
 for UIControlStateNormal.

 @param state The control state.
 @return The elevation for the requested state.
 */
- (MDCShadowElevation)elevationForState:(UIControlState)state;

/*
 Sets the elevation for a particular control state.

 @param elevation The elevation.
 @param state The control state.
 */
- (void)setElevation:(MDCShadowElevation)elevation
            forState:(UIControlState)state UI_APPEARANCE_SELECTOR;

/*
 Returns the ink color for a particular control state.

 If no ink color has been set for a given state, the returned value will fall back to the value
 set for UIControlStateNormal. Defaults to nil. When nil MDCInkView.defaultInkColor is used.

 @param state The control state.
 @return The ink color for the requested state.
 */
- (nullable UIColor *)inkColorForState:(UIControlState)state;

/*
 Sets the ink color for a particular control state.

 @param inkColor The ink color.
 @param state The control state.
 */
- (void)setInkColor:(nullable UIColor *)inkColor
           forState:(UIControlState)state UI_APPEARANCE_SELECTOR;

/*
 Returns the shadow color for a particular control state.

 If no shadow color has been set for a given state, the returned value will fall back to the value
 set for UIControlStateNormal.

 @param state The control state.
 @return The shadow color for the requested state.
 */
- (nullable UIColor *)shadowColorForState:(UIControlState)state;

/*
 Sets the shadow color for a particular control state.

 @param elevation The shadow color.
 @param state The control state.
 */
- (void)setShadowColor:(nullable UIColor *)shadowColor
              forState:(UIControlState)state UI_APPEARANCE_SELECTOR;

/*
 Returns the title color for a particular control state.

 If no title color has been set for a given state, the returned value will fall back to the value
 set for UIControlStateNormal.

 @param state The control state.
 @return The title color for the requested state.
 */
- (nullable UIColor *)titleColorForState:(UIControlState)state;

/*
 Sets the title color for a particular control state.

 @param titleColor The title color.
 @param state The control state.
 */
- (void)setTitleColor:(nullable UIColor *)titleColor
             forState:(UIControlState)state UI_APPEARANCE_SELECTOR;

@end

Undocumented

  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, readonly, nonnull) IBInspectable UIImageView *imageView
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, readonly, nonnull) IBInspectable UIImageView *selectedImageView
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, strong, nullable) IBInspectable UIView *accessoryView
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, readonly, nonnull) IBInspectable UILabel *titleLabel
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, assign) UIEdgeInsets contentPadding
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, assign) UIEdgeInsets imagePadding
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, assign) UIEdgeInsets accessoryPadding
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, assign) UIEdgeInsets titlePadding
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, strong, nullable) UIFont *titleFont
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, assign) BOOL enableRippleBehavior
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, strong, null_resettable)
        UIColor *inkColor
  • Undocumented

    Declaration

    Objective-C

    @property(nullable, nonatomic, strong) id<MDCShapeGenerating> shapeGenerator
  • Undocumented

    Declaration

    Objective-C

    @property(nonatomic, readwrite, setter=mdc_setAdjustsFontForContentSizeCategory:)
        BOOL mdc_adjustsFontForContentSizeCategory
  • The minimum dimensions of the Chip. A non-positive value for either height or width is equivalent to no minimum for that dimension.

    Defaults to a minimum height of 32 points, and no minimum width.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGSize minimumSize;
  • Custom insets to use when computing touch targets. A positive inset value will shrink the hit area for the Chip.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) UIEdgeInsets hitAreaInsets;
  • Undocumented

    Declaration

    Objective-C

    - (nullable UIColor *)backgroundColorForState:(UIControlState)state;
  • Undocumented

    Declaration

    Objective-C

    - (void)setBackgroundColor:(nullable UIColor *)backgroundColor
                      forState:(UIControlState)state UI_APPEARANCE_SELECTOR;
  • Undocumented

    Declaration

    Objective-C

    - (nullable UIColor *)borderColorForState:(UIControlState)state;
  • Undocumented

    Declaration

    Objective-C

    - (void)setBorderColor:(nullable UIColor *)borderColor
                  forState:(UIControlState)state UI_APPEARANCE_SELECTOR;
  • Undocumented

    Declaration

    Objective-C

    - (CGFloat)borderWidthForState:(UIControlState)state;
  • Undocumented

    Declaration

    Objective-C

    - (void)setBorderWidth:(CGFloat)borderWidth forState:(UIControlState)state UI_APPEARANCE_SELECTOR;
  • Undocumented

    Declaration

    Objective-C

    - (MDCShadowElevation)elevationForState:(UIControlState)state;
  • Undocumented

    Declaration

    Objective-C

    - (void)setElevation:(MDCShadowElevation)elevation
                forState:(UIControlState)state UI_APPEARANCE_SELECTOR;
  • Undocumented

    Declaration

    Objective-C

    - (nullable UIColor *)inkColorForState:(UIControlState)state;
  • Undocumented

    Declaration

    Objective-C

    - (void)setInkColor:(nullable UIColor *)inkColor
               forState:(UIControlState)state UI_APPEARANCE_SELECTOR;
  • Undocumented

    Declaration

    Objective-C

    - (nullable UIColor *)shadowColorForState:(UIControlState)state;
  • Undocumented

    Declaration

    Objective-C

    - (void)setShadowColor:(nullable UIColor *)shadowColor
                  forState:(UIControlState)state UI_APPEARANCE_SELECTOR;
  • Undocumented

    Declaration

    Objective-C

    - (nullable UIColor *)titleColorForState:(UIControlState)state;
  • Undocumented

    Declaration

    Objective-C

    - (void)setTitleColor:(nullable UIColor *)titleColor
                 forState:(UIControlState)state UI_APPEARANCE_SELECTOR;