Search code examples
iosswift2xcode7mmdrawercontroller

How to set the Drawer width of MMDrawerController to the width of the Screen using Swift 2?


I am Using MMDrawerController on my Project. I have a Menu that shows from Left to Right and It is working Properly. But my requirement is to have a drawer that have a width of the current screen Width. How can i do that Using Swift ?

Currently the screen looks like this , I need to have the White area to cover Up the Entire Screen.

enter image description here


Solution

  • Use setMaximumLeftDrawerWidth property of MMDrawerController like

      centerContainer?.setMaximumLeftDrawerWidth(UIScreen.mainScreen().bounds.width, animated: true, completion: nil)  
    

    You can check the method in MMDrawerController.h

    -(void)setMaximumLeftDrawerWidth:(CGFloat)width animated:(BOOL)animated completion:(void(^)(BOOL finished))completion;