MenuViewController

@available(iOS 9.0, *)
@objcMembers
@objc(PESDKMenuViewController)
open class MenuViewController : ViewController
extension MenuViewController: MenuListSectionControllerSelectionDelegate
extension MenuViewController: MenuListSectionControllerListDisplayDelegate
extension MenuViewController: TransitionProviding

A MenuViewController displays a menu at the bottom of its view and the view of an arbitrary contained UIViewController above that menu.

Properties

  • The view controller whose view should be displayed above the menu.

    Declaration

    Swift

    public let contentViewController: UIViewController
  • When selecting an item in the menu, the item can either remain selected until manually deselected (true) or be immediately deselected automatically (false). The default is false.

    Declaration

    Swift

    open var keepsSelection: Bool
  • An object that acts as the delegate.

    Declaration

    Swift

    open weak var delegate: MenuViewControllerDelegate?
  • The collection view which displays the menu.

    Declaration

    Swift

    open private(set) lazy var collectionView: MenuCollectionView { get set }
  • The view above the menu, where the contentViewController‘s view is added to.

    Declaration

    Swift

    open private(set) lazy var workspaceView: UIView { get set }
  • The view that hosts the collectionView. It extends below the bottom safeAreaLayoutGuide if needed.

    Declaration

    Swift

    open private(set) lazy var accessoryView: MenuAccessoryContainerView { get set }
  • The menu items that this menu view controller displays.

    Declaration

    Swift

    open var menuItems: [MenuItem]
  • The height of the menu. Default is 88.

    Declaration

    Swift

    open var menuHeight: CGFloat { get set }
  • Whether the menu is currently hidden or not.

    Declaration

    Swift

    open private(set) var isMenuHidden: Bool { get }

Initializers

  • Creates a new MenuViewController with the given content view controller.

    Declaration

    Swift

    public required init(
     contentViewController: UIViewController
    )

    Parameters

    contentViewController

    The content view controller to show above the menu.

Menu Showing / Hiding

  • Shows the menu.

    Declaration

    Swift

    open func showMenu(animated: Bool)

    Parameters

    animated

    Whether this change should be animated or not.

  • Hides the menu.

    Declaration

    Swift

    open func hideMenu(animated: Bool)

    Parameters

    animated

    Whether this change should be animated or not.

Reload API

  • Performs an immediate reload of the menu.

    Attention

    If possible you should use performUpdates(animated:completion:) instead because it is less expensive.

    Declaration

    Swift

    open func reloadData(completion: ((Bool) -> Void)?)

    Parameters

    completion

    The block to execute when the reload completes. The passed Bool variable specifies whether or not the update animations completed successfully.

  • Performs an update from the previous state of the menu.

    Declaration

    Swift

    open func performUpdates(animated: Bool, completion: ((Bool) -> Void)?)

    Parameters

    animated

    A flag indicating if the transition should be animated.

    completion

    The block to edecuted when the updates complete.

  • Reloads the menu for only the specified menu items.

    Declaration

    Swift

    open func reloadMenuItems(_ menuItems: [MenuItem])

    Parameters

    menuItems

    The menu items to reload.