Classes

The following classes are available globally.

  • A Material flat, raised or floating button.

    All buttons display animated ink splashes when the user interacts with the button.

    The title color of the button set to have an accessible contrast ratio with the button’s background color. To ensure this works for flat buttons (with transparent background), the caller is responsible for setting (and updating, if necessary) the button’s underlyingColor property.

    All buttons set the exclusiveTouch property to YES by default, which prevents users from simultaneously interacting with a button and other UI elements.

    See more

    Declaration

    Objective-C

    @interface MDCButton : UIButton
  • A flat MDCButton.

    Flat buttons should be considered the default button. They do not have their own background color, do not raise when touched, and have uppercased text to indicate to the user that they are buttons. Flat buttons should be used in most situations requiring a button. For layouts with many UI elements in which a flat button might get visually lost, consider using a MDCRaisedButton instead.

    Warning

    This class will be deprecated soon. Consider using @c MDCTextButtonThemer with an @c MDCButton instead.

    See more

    Declaration

    Objective-C

    @interface MDCFlatButton : MDCButton
  • A raised MDCButton.

    Raised buttons have their own background color, float above their parent slightly, and raise briefly when touched. Raised buttons should be used when flat buttons would get lost among other UI elements on the screen.

    Warning

    This class will be deprecated soon. Consider using @c MDCContainedButtonThemer with an @c MDCButton instead.

    Declaration

    Objective-C

    @interface MDCRaisedButton : MDCButton
  • MDCAlertController displays an alert message to the user, similar to UIAlertController.

    https://material.io/go/design-dialogs

    MDCAlertController class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.

    See more

    Declaration

    Objective-C

    @interface MDCAlertController : UIViewController
  • MDCAlertAction is passed to an MDCAlertController to add a button to the alert dialog.

    See more

    Declaration

    Objective-C

    @interface MDCAlertAction : NSObject <NSCopying, UIAccessibilityIdentification>
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface MDCAlertControllerView : UIView
    
    @property(nonatomic, strong, nullable) UIFont *titleFont UI_APPEARANCE_SELECTOR;
    @property(nonatomic, strong, nullable) UIColor *titleColor UI_APPEARANCE_SELECTOR;
    
    @property(nonatomic, assign) NSTextAlignment titleAlignment;
    @property(nonatomic, strong, nullable) UIImage *titleIcon;
    @property(nonatomic, strong, nullable) UIColor *titleIconTintColor;
    
    @property(nonatomic, strong, nullable) UIFont *messageFont UI_APPEARANCE_SELECTOR;
    @property(nonatomic, strong, nullable) UIColor *messageColor UI_APPEARANCE_SELECTOR;
    
    // b/117717380: Will be deprecated (x3)
    @property(nonatomic, strong, nullable) UIFont *buttonFont UI_APPEARANCE_SELECTOR;
    @property(nonatomic, strong, nullable) UIColor *buttonColor UI_APPEARANCE_SELECTOR;
    @property(nonatomic, strong, nullable) UIColor *buttonInkColor UI_APPEARANCE_SELECTOR;
    
    @property(nonatomic, assign) CGFloat cornerRadius;
    
    /*
     Indicates whether the view's contents should automatically update their font when the device’s
     UIContentSizeCategory changes.
    
     This property is modeled after the adjustsFontForContentSizeCategory property in the
     UIContentSizeCategoryAdjusting protocol added by Apple in iOS 10.
    
     Default value is NO.
     */
    @property(nonatomic, readwrite, setter=mdc_setAdjustsFontForContentSizeCategory:)
        BOOL mdc_adjustsFontForContentSizeCategory UI_APPEARANCE_SELECTOR;
    
    @end
  • MDCDialogPresentationController will present a modal ViewController as a dialog according to the Material spec.

    https://material.io/go/design-dialogs

    MDCDialogPresentationController should not be used to present full-screen dialogs.

    The presented UIViewController will be asked for it’s preferredContentSize to help determine the best size for the dialog to be displayed.

    This controller will manage the background dimming view and add a material-styled shadow underneath the presented view.

    This controller will respond to the display / dismissal of the keyboard and update the presentedView’s frame.

    See more

    Declaration

    Objective-C

    @interface MDCDialogPresentationController : UIPresentationController
  • MDCDialogTransitionController is be used to setup a custom transition and animationed presentation and dismissal for material-styled alerts, simple dialogs and confirmation dialogs.

    https://material.io/go/design-dialogs

    This class provides a basic implementation of UIViewControllerAnimatedTransitioning and UIViewControllerTransitioningDelegate.

    In order to use a custom modal transition, the UIViewController to be presented must set two properties. The UIViewControllers transitioningDelegate should be set to an instance of this class. myDialogViewController.modalPresentationStyle = UIModalPresentationCustom; myDialogViewController.transitioningDelegate = dialogTransitionController;

    The presenting UIViewController then calls presentViewController:animated:completion: [rootViewController presentViewController:myDialogViewController animated:YES completion:…];

    Declaration

    Objective-C

    @interface MDCDialogTransitionController
        : NSObject <UIViewControllerAnimatedTransitioning,
                    UIViewControllerTransitioningDelegate>
  • Custom gesture recognizer to observe the various ink response states.

    MDCInkGestureRecognizer is a continuous recognizer that tracks single touches and optionally fails if the touch moves outside the recongizer’s view. Multiple touches will cause the recognizer to transition to the UIGestureRecognizerStateCancelled state.

    See more

    Declaration

    Objective-C

    @interface MDCInkGestureRecognizer : UIGestureRecognizer
  • MDCInkTouchController associates a MDCInkView with a UIGestureRecognizer to control the spread of the ink.

    Subclasses should avoid overriding the UIGestureRecognizerDelegate gestureRecognizerShouldBegin: and gestureRecognizer:shouldReceiveTouch: methods to avoid breaking MDCInkTouchControllerDelegate.

    NOTE: The controller does not keep a strong reference to the view to which it is attaching an ink view. It is expected that the view will keep a strong reference to its own ink controller, or that the view controller controlling the view will keep a strong reference to that view’s ink controller.

    See more

    Declaration

    Objective-C

    @interface MDCInkTouchController : NSObject <UIGestureRecognizerDelegate>
  • A UIView that draws and animates the Material Design ink effect for touch interactions.

    There are two kinds of ink:

    Bounded ink: Ink that spreads from a point and is contained in the bounds of a UI element such as a button. The ink is visually clipped to the bounds of the UI element. Bounded ink is the most commonly-used ink in the system. Examples include basic Material buttons, list menu items, and tile grids.

    Unbounded ink: Ink that spreads out from a point on top of other UI elements. It typically reaches a maximum circle radius and then fades, unclipped by other UI elements. Typically used when interacting with small UI elements such as navigation bar icons or slider thumb controls. Examples include overflow menus, icon toggle buttons, and phone dialer keys.

    Note that the two kinds of ink are designed to have different animation parameters, that is, bounded ink isn’t just clipped unbounded ink. Whether the ink is bounded or not depends on the kind of UI element the user is interacting with.

    See more

    Declaration

    Objective-C

    @interface MDCInkView : UIView
  • Metrics of the Material shadow effect.

    These can be used if you require your own shadow implementation but want to match the material spec.

    See more

    Declaration

    Objective-C

    @interface MDCShadowMetrics : NSObject
  • The Material shadow effect.

    @see https://material.io/guidelines/what-is-material/elevation-shadows.html#elevation-shadows-shadows

    Consider rasterizing your MDCShadowLayer if your view will not generally be animating or changing size. If you need to animate a rasterized MDCShadowLayer, disable rasterization first.

    For example, if self’s layerClass is MDCShadowLayer, you might introduce the following code:

    self.layer.shouldRasterize = YES;
    self.layer.rasterizationScale = [UIScreen mainScreen].scale;
    
    See more

    Declaration

    Objective-C

    @interface MDCShadowLayer : CALayer
  • MDCCornerTreatment is a factory for creating MDCPathGenerators that represent the path of a corner.

    MDCCornerTreatments should only generate corners in the top-left quadrant (i.e. the top-left corner of a rectangle). MDCShapeModel will translate the generated MDCPathGenerator to the expected position and rotation.

    See more

    Declaration

    Objective-C

    @interface MDCCornerTreatment : NSObject <NSCopying>
  • MDCEdgeTreatment is a factory for creating MDCPathGenerators that represent the path of a edge.

    MDCEdgeTreaments only generate in the top quadrant (i.e. the top edge of a rectangle). MDCShapeModel will transform the generated MDCPathGenerator to the expected position and rotation.

    See more

    Declaration

    Objective-C

    @interface MDCEdgeTreatment : NSObject <NSCopying>
  • MDCPathGenerator is a factory for creating CGPaths. Describe your path with the lineTo and addArc… methods, then call appendToCGPath to append them to a CGPath.

    Note

    MDCPathGenerators always start at (0, 0) and end at @c endPoint.
    See more

    Declaration

    Objective-C

    @interface MDCPathGenerator : NSObject
  • An MDCShapeGenerating for creating shaped rectanglular CGPaths.

    By default MDCRectangleShapeGenerator creates rectanglular CGPaths. Set the corner and edge treatments to shape parts of the generated path.

    See more

    Declaration

    Objective-C

    @interface MDCRectangleShapeGenerator : NSObject <MDCShapeGenerating>
  • MDCShapedView is a primitive view class which makes it easy to style the shape of the view’s edges and corners.

    MDCShapedView manages mapping the paths generated by the shapeGenerator to the backing CAShapeLayer whenever the view is resized.

    See more

    Declaration

    Objective-C

    @interface MDCShapedView : UIView