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

1

5

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

Valve answered 13/10, 2015 at 5:11 Comment(0)
H
7

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;
Heighho answered 13/10, 2015 at 5:16 Comment(3)
I saw Some Codes to do the same , Should i have to include that in AppDelegate file ?Valve
yes...whenever I used,I used it in appDelegate fileHeighho
Please I'm setting the right menu depending on the button clicked (if the clicked button is btn1 so I set the right side menu to btnVC1, else I set it to btnVC2). The btnVC1 width have to be as the default given width by the MMDrawerController (less than the screen width), but the btnVC2 width has to be the same as the screen one. I set the width of each of them in the IBActions but when I swipe in order to close the right menu, the center view disapear (I get only black screen). Also the widths are not set correctly. Can you help me please?Sammie

© 2022 - 2024 — McMap. All rights reserved.