MDCBottomDrawerViewController

@interface MDCBottomDrawerViewController
    : UIViewController <MDCBottomDrawerPresentationControllerDelegate>

View controller for containing a Google Material bottom drawer.

  • The main content displayed by the drawer. Its height is determined by the returned preferred content size.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, nullable)
        UIViewController *contentViewController;
  • A header to display above the drawer’s main content. Its height is determined by the returned preferred content size.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, nullable)
        UIViewController<MDCBottomDrawerHeader> *headerViewController;
  • Setting the tracking scroll view allows the drawer scroll the content seamlessly as part of the drawer movement. This allows the provided scroll view to load the visible content as the drawer moves, and therefore not load all the content at once and allow to reuse the cells when using a UICollectionView or UITableView.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable) UIScrollView *trackingScrollView;
  • The current state of the bottom drawer.

    Declaration

    Objective-C

    @property (readonly, nonatomic) MDCBottomDrawerState drawerState;
  • The color applied to the background scrim.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable) UIColor *scrimColor;
  • A Boolean value that determines whether the top handle of the drawer is hidden. Default is YES.

    Declaration

    Objective-C

    @property (getter=isTopHandleHidden, assign, readwrite, nonatomic)
        BOOL topHandleHidden;
  • The color applied to the top handle. Note: Make sure that topHandleHidden is set to NO to have the top handle be visible. Default is set to 0xE0E0E0.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable) UIColor *topHandleColor;
  • The absolute height in points to which the drawer may expand initially.

    Defaults to 0, indicating no value has been set and it should use the default behavior of 50% of the screen’s height.

    If the value is larger than the container’s height, this will result the drawer being presented at fullscreen.

    Note: When TraitCollection is UIUserInterfaceSizeClassCompact or when using VoiceOver or SwitchControl, the drawer will always present at full screen.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGFloat maximumInitialDrawerHeight;
  • A flag allowing clients to opt-in to the drawer adding additional height to the content to include the bottom safe area inset. This will remove the need for clients to calculate their content size with the bottom safe area when setting the preferredContentSize of the contentViewController. Defaults to NO.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        BOOL shouldIncludeSafeAreaInContentHeight;
  • The bottom drawer delegate.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable)
        id<MDCBottomDrawerViewControllerDelegate>
            delegate;
  • Sets the top corners radius for an MDCBottomDrawerState drawerState

    Declaration

    Objective-C

    - (void)setTopCornersRadius:(CGFloat)radius
                 forDrawerState:(MDCBottomDrawerState)drawerState;

    Parameters

    radius

    The corner radius to set the top corners.

    drawerState

    MDCBottomDrawerState the drawer state.

  • Returns the top corners radius for an MDCBottomDrawerState drawerState.

    If no radius has been set for a state, the value 0 is returned.

    Declaration

    Objective-C

    - (CGFloat)topCornersRadiusForDrawerState:(MDCBottomDrawerState)drawerState;

    Parameters

    drawerState

    MDCBottomDrawerState the drawer state.

    Return Value

    The corner radius to set the top corners.

  • Sets the content offset Y of the drawer’s content. If contentOffsetY is set to 0, the drawer will scroll to the start of its content.

    Declaration

    Objective-C

    - (void)setContentOffsetY:(CGFloat)contentOffsetY animated:(BOOL)animated;

    Parameters

    contentOffsetY

    the content offset Y of the scroll view.

    animated

    a bool if to animate the scrolling.

  • Expands the drawer to fullscreen with animation.

    note: If the drawer has less content than the full screen, this method will still expand the drawer to fullscreen.

    Declaration

    Objective-C

    - (void)expandToFullscreenWithDuration:(CGFloat)duration
                                completion:(void (^_Nullable)(BOOL))completion;

    Parameters

    duration

    The total duration of the animations, measured in seconds. If you specify a negative value or 0, the changes are made without animating them.

    completion

    A block object to be executed when the animation sequence ends. This block has no return value and takes a single Boolean argument that indicates whether or not the animations actually finished before the completion handler was called. If the duration of the animation is 0, this block is performed at the beginning of the next run loop cycle. This parameter may be NULL.