Inherits from UIViewController
Declared in MSDynamicsDrawerViewController.h
MSDynamicsDrawerViewController.m

Overview

MSDynamicsDrawerViewController is a container view controller that manages the presentation of a single “pane” view controller overlaid over one or two “drawer” view controllers. The drawer view controllers are hidden by default, but can be exposed by a user-initiaed swipe in the direction that that drawer view controller is set in.

Tasks

Managing the Child View Controllers

Accessing & Modifying State

Configuring Dynamics Behaviors

Configuring Gestures

Configuring Stylers

Configuring Reveal Width

Container Views

  •   drawerView

    The drawer view contains the currently visible drawer view controller’s view.

    property
  •   paneView

    The pane view contains the pane view controller’s view.

    property

Properties

bounceElasticity

The amount of elasticity applied to the pane view when it is bounced open.

@property (nonatomic, assign) CGFloat bounceElasticity

Discussion

Applies when the pane is bounced open. Default value of 0.5. Valid range is from 0.0 for no bounce upon collision, to 1.0 for completely elastic collisions.

Declared In

MSDynamicsDrawerViewController.h

bounceMagnitude

The magnitude of the push vector that is applied to the pane view when bouncePaneOpen is called.

@property (nonatomic, assign) CGFloat bounceMagnitude

Discussion

Applies when the pane is bounced open. Default of 60.0. A magnitude value of 1.0 represents an acceleration of 1000 points / second².

Declared In

MSDynamicsDrawerViewController.h

drawerView

The drawer view contains the currently visible drawer view controller’s view.

@property (nonatomic, readonly) UIView *drawerView

Discussion

The drawerView is always presented underneath the paneView. The frame of the drawerView never moves, and it is not affected by dynamics.

Declared In

MSDynamicsDrawerViewController.h

elasticity

The elasticity applied to the pane view.

@property (nonatomic, assign) CGFloat elasticity

Discussion

Default value of 0.0. Valid range is from 0.0 for no bounce upon collision, to 1.0 for completely elastic collisions.

Declared In

MSDynamicsDrawerViewController.h

gravityMagnitude

The magnitude of the gravity vector that affects the pane view.

@property (nonatomic, assign) CGFloat gravityMagnitude

Discussion

Default value of 2.0. A magnitude value of 1.0 represents an acceleration of 1000 points / second².

Declared In

MSDynamicsDrawerViewController.h

paneState

The state of the pane view as defined in a MSDynamicsDrawerPaneState.

@property (nonatomic, assign) MSDynamicsDrawerPaneState paneState

Discussion

The possible states are MSDynamicsDrawerPaneStateClosed, where the drawerView is entirely hidden by the paneView, MSDynamicsDrawerPaneStateOpen, wherein the drawerView is revealed to the reveal width for the specified direction, and MSDynamicsDrawerPaneStateOpenWide where the drawerView in revealed by the paneView in its entirety such that the paneView is opened past the edge of the screen. If there is more than one drawer view controller set, use setPaneState:inDirection: instead and specify a direction.

Declared In

MSDynamicsDrawerViewController.h

paneView

The pane view contains the pane view controller’s view.

@property (nonatomic, readonly) UIView *paneView

Discussion

The user can slide the paneView in any of the directions defined in possibleDrawerDirection to reveal the drawer view controller underneath. The frame of the paneView is frequently updated by internal dynamics and user gestures.

Declared In

MSDynamicsDrawerViewController.h

paneViewController

The pane view controller is the primary view controller, displayed centered and covering the drawer view controllers.

@property (nonatomic, strong) UIViewController *paneViewController

Declared In

MSDynamicsDrawerViewController.h

paneViewSlideOffAnimationEnabled

If setting a new paneViewController should have an animation that slides off the old view controller before animating the new one into its place.

@property (nonatomic, assign) BOOL paneViewSlideOffAnimationEnabled

Discussion

This animation only occurs when the method setPaneViewController:animated:completion: is invoked with an animated parameter of YES.

Declared In

MSDynamicsDrawerViewController.h

possibleDrawerDirection

The directions that the paneView can be opened in.

@property (nonatomic, assign, readonly) MSDynamicsDrawerDirection possibleDrawerDirection

Discussion

Corresponds to the directions that there are drawer view controllers set for. If more than one drawer view controller is set, this will be a bitmask of the directions that the drawer view controllers are set in.

Declared In

MSDynamicsDrawerViewController.h

shouldAlignStatusBarToPaneView

If the status bar should align with the pane view as the pane view frame is adjusted by both the user gestures and the internal dynamic animator.

@property (nonatomic, assign) BOOL shouldAlignStatusBarToPaneView

Declared In

MSDynamicsDrawerViewController.h

Instance Methods

addStyler:forDirection:

Adds a styler (a class that conforms to the MSDynamicsDrawerStyler protocol).

- (void)addStyler:(id<MSDynamicsDrawerStyler>)styler forDirection:(MSDynamicsDrawerDirection)direction

Parameters

styler

The styler that should be added.

direction

The direction that the styler apply to. Accepts masked direction values.

Declared In

MSDynamicsDrawerViewController.h

addStylersFromArray:forDirection:

Adds an array of stylers (classes that conform to the MSDynamicsDrawerStyler protocol).

- (void)addStylersFromArray:(NSArray *)stylers forDirection:(MSDynamicsDrawerDirection)direction

Parameters

stylers

The array of stylers that should be added.

direction

The direction that the stylers apply to. Accepts masked direction values.

Declared In

MSDynamicsDrawerViewController.h

bouncePaneOpen

Bounces the paneView open to reveal the drawerView underneath.

- (void)bouncePaneOpen

Discussion

If there is more than one drawer view controller set, use bouncePaneOpenInDirection:. When invoked, bounceElasticity and bounceMagnitude are used as the dynamics values for the paneView.

Declared In

MSDynamicsDrawerViewController.h

bouncePaneOpenInDirection:

Bounces the paneView open in the specified direction, revealing the drawerView underneath.

- (void)bouncePaneOpenInDirection:(MSDynamicsDrawerDirection)direction

Parameters

direction

The direction that the paneView will be bounced open in. ?

Discussion

If there is only one drawer view controller, use bouncePaneOpen instead. When invoked, bounceElasticity and bounceMagnitude are used as the dynamics values for the paneView.

Declared In

MSDynamicsDrawerViewController.h

drawerViewControllerForDirection:

Returns the drawer view controller that has been set for the specified direction.

- (UIViewController *)drawerViewControllerForDirection:(MSDynamicsDrawerDirection)direction

Parameters

direction

The direction that the drawer view controller should be revealed. Must not be masked.

Return Value

The drawer view controller that has been set for the specified direction. If not yet set, nil.

Declared In

MSDynamicsDrawerViewController.h

paneDragRevealEnabledForDirection:

Returns if a user-initiated pan gesture on the paneView can move the pane in the specified direction.

- (BOOL)paneDragRevealEnabledForDirection:(MSDynamicsDrawerDirection)direction

Parameters

direction

The direction to check against. Does not accept masked direction values.

Return Value

If dragging is enabled in the specified direction.

Declared In

MSDynamicsDrawerViewController.h

paneTapToCloseEnabledForDirection:

Returns if a user-initiated tap gesture on the paneView can close it while it is opened.

- (BOOL)paneTapToCloseEnabledForDirection:(MSDynamicsDrawerDirection)direction

Parameters

direction

The direction to check against. Does not accept masked direction values.

Return Value

If tap-to-close is enabled for the specified direction.

Declared In

MSDynamicsDrawerViewController.h

registerTouchForwardingClass:

Attempts to register a UIView subclass that the pane view should forward dragging through.

- (void)registerTouchForwardingClass:(Class)touchForwardingClass

Parameters

touchForwardingClass

The class that should not allow pan gestures through.

Discussion

When the user drags the paneView to reveal the drawerView underneath, if the pan gesture is performed on an instance of a class that has been registed as a touch forwarding class, the gesture is ignored. By default, UISlider and UISwitch are registered as touch forwarding classes.

Declared In

MSDynamicsDrawerViewController.h

removeStyler:forDirection:

Removes a styler (a class that conforms to the MSDynamicsDrawerStyler protocol).

- (void)removeStyler:(id<MSDynamicsDrawerStyler>)styler forDirection:(MSDynamicsDrawerDirection)direction

Parameters

styler

The styler that should be removed.

direction

The direction that they styler should be removed for. Accepts masked direction values.

Declared In

MSDynamicsDrawerViewController.h

revealWidthForDirection:

Returns the reveal width that the paneView opens when revealing the drawerView for the specified direction

- (CGFloat)revealWidthForDirection:(MSDynamicsDrawerDirection)direction

Parameters

direction

The direction that the reveal width should be returned for. Does not accept masked direction values.

Return Value

The reveal width for the specified direction.

Declared In

MSDynamicsDrawerViewController.h

setDrawerViewController:forDirection:

Sets the view controller to be revealed as a drawer in the specified direction underneath the pane view controller.

- (void)setDrawerViewController:(UIViewController *)drawerViewController forDirection:(MSDynamicsDrawerDirection)direction

Parameters

drawerViewController

The view controller to revealed as a drawer

direction

The direction that the drawer view controller should be revealed in. Does not accept masked direction values.

Discussion

There is a maximum of two drawer view controllers that can be set simultaneously. When a second view controllers is set, it must be in the opposite direction of the first view controller. When a single drawer view controller is set, it can be set in any of the cardinal directions.

Declared In

MSDynamicsDrawerViewController.h

setPaneDragRevealEnabled:forDirection:

Sets if a user-initiated pan gesture on the paneView can move the pane in the specified direction.

- (void)setPaneDragRevealEnabled:(BOOL)paneDraggingEnabled forDirection:(MSDynamicsDrawerDirection)direction

Parameters

paneDraggingEnabled

Whether dragging should be enabled.

direction

The direction that dragging should be enabled for. Accepts masked direction values.

Declared In

MSDynamicsDrawerViewController.h

setPaneState:animated:allowUserInterruption:completion:

Sets the state of the pane view as defined in a MSDynamicsDrawerPaneState.

- (void)setPaneState:(MSDynamicsDrawerPaneState)paneState animated:(BOOL)animated allowUserInterruption:(BOOL)allowUserInterruption completion:(void ( ^ ) ( void ))completion

Parameters

paneState

The state of the pane view.

animated

Whether the transition should be animated.

allowUserInterruption

If the user should be able to interrupt the pane state transition with gestures.

completion

Called upon completion of the update to the pane state. If the user interrupts the transition, the completion will be called when the internal dynamic animator completes.

Discussion

If the value for the animated parameter is NO, then this method is functionally equivalent to using the paneState setter. If there is more than one drawer view controller set, use setPaneState:inDirection:animated:allowUserInterruption:completion: instead and specify a direction.

Declared In

MSDynamicsDrawerViewController.h

setPaneState:inDirection:

The state of the pane view as defined in a MSDynamicsDrawerPaneState.

- (void)setPaneState:(MSDynamicsDrawerPaneState)paneState inDirection:(MSDynamicsDrawerDirection)direction

Discussion

The possible states are MSDynamicsDrawerPaneStateClosed, where the drawerView is entirely hidden by the paneView, MSDynamicsDrawerPaneStateOpen, wherein the drawerView is revealed to the reveal width for the specified direction, and MSDynamicsDrawerPaneStateOpenWide where the drawerView in revealed by the paneView in its entirety such that the paneView is opened past the edge of the screen. If there is only one drawer view controller set, use paneState property instead.

Declared In

MSDynamicsDrawerViewController.h

setPaneState:inDirection:animated:allowUserInterruption:completion:

Sets the state of the pane view as defined in a MSDynamicsDrawerPaneState.

- (void)setPaneState:(MSDynamicsDrawerPaneState)paneState inDirection:(MSDynamicsDrawerDirection)direction animated:(BOOL)animated allowUserInterruption:(BOOL)allowUserInterruption completion:(void ( ^ ) ( void ))completion

Parameters

paneState

The state of the pane view.

direction

The direction that the paneState update should be applied in.

animated

Whether the transition should be animated.

allowUserInterruption

If the user should be able to interrupt the pane state transition with gestures.

completion

Called upon completion of the update to the pane state. If the user interrupts the transition, the completion will be called when the internal dynamic animator completes.

Discussion

If the value for the animated parameter is NO, then this method is functionally equivalent to using the paneState setter. If there is only one drawer view controller set, use setPaneState:animated:allowUserInterruption:completion: instead.

Declared In

MSDynamicsDrawerViewController.h

setPaneTapToCloseEnabled:forDirection:

Sets if a user-initiated tap gesture on the paneView can close it while it is opened.

- (void)setPaneTapToCloseEnabled:(BOOL)paneTapToCloseEnabled forDirection:(MSDynamicsDrawerDirection)direction

Parameters

paneTapToCloseEnabled

Whether tap-to-close should be enabled.

direction

The direction that tap-to-close should be enabled for. Accepts masked direction values.

Declared In

MSDynamicsDrawerViewController.h

setPaneViewController:animated:completion:

Sets the paneViewController with an animated transition.

- (void)setPaneViewController:(UIViewController *)paneViewController animated:(BOOL)animated completion:(void ( ^ ) ( void ))completion

Parameters

paneViewController

The paneViewController to be added.

animated

Whether adding the pane should be animated.

completion

An optional completion block called upon the completion of the paneViewController being set.

Discussion

If the value for the animated parameter is NO, then this method is functionally equivalent to using the paneViewController setter.

Declared In

MSDynamicsDrawerViewController.h

setRevealWidth:forDirection:

Sets the width that the paneView opens when revealing the drawerView underneath for the specified direction.

- (void)setRevealWidth:(CGFloat)revealWidth forDirection:(MSDynamicsDrawerDirection)direction

Parameters

revealWidth

The width that the paneView opens when revealing the drawerView.

direction

The direction that the revealWidth should be applied in. Accepts masked direction values.

@see

Discussion

Defaults to MSDynamicsDrawerDefaultOpenStateRevealWidthHorizontal when drawer view controllers are set in a horizontal direction. Defaults to MSDynamicsDrawerDefaultOpenStateRevealWidthVertical when drawer view controllers are set in a vertical direction.

Declared In

MSDynamicsDrawerViewController.h

stylersForDirection:

Returns an array of the stylers that are set in a specified direction

- (NSArray *)stylersForDirection:(MSDynamicsDrawerDirection)direction

Parameters

direction

The direction that the stylers should be returned for. Accepts masked direction values.

Return Value

An array of stylers that are

Declared In

MSDynamicsDrawerViewController.h