MDCBottomDrawerPresentationController

@interface MDCBottomDrawerPresentationController : UIPresentationController

The presentation controller to use for presenting an MDC bottom drawer.

  • 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 color applied to the background scrim.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable) UIColor *scrimColor;
  • Delegate to tell the presenter when the drawer will change state.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable)
        id<MDCBottomDrawerPresentationControllerDelegate>
            delegate;
  • 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;
  • A boolean value that indicates whether the drawer is currently the full height of the window.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL contentReachesFullscreen;
  • 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.