1

I am using MMDrawerController to create slide menu in my iOS app. Menu is working well but i have some troubles with it. My menu is ViewController with TableView with very light 4 custom cells.

  1. My app now have top bar - i don't know how can i turn it off.
  2. I have button that show my menu. Menu looks well when i open it by sliding with my finger on the screen but when i run app for first time and push this button menu opens with some visual lag. It seems that menu is not completely loaded - so it is showing first near the top of screen and then it goes down on proper place. It happens only in case when i open menu first time with button. Here is the action.

    @IBAction func showMenu(sender: AnyObject) 
    {
      var appDelegate : AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
      appDelegate.centerContainer?.toggleDrawerSide(MMDrawerSide.Left, animated: true, completion: nil)
    }
    
  3. How can i set width of menu? My menu is very wide, maybe it can be customized to be smaller.

Jay Bhalani
  • 4,142
  • 8
  • 37
  • 50
moonvader
  • 19,761
  • 18
  • 67
  • 116
  • Please is the appDelegate.centerContainer?.toggleDrawerSide(MMDrawerSide.Left, animated: true, completion: nil) close the menu? Because in my case it's only open it – Ne AS Jan 22 '17 at 19:08

2 Answers2

3
  1. To hide the status bar you can use

    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
    

    or the swift version

    UIApplication.sharedApplication().setStatusBarHidden(true, withAnimation: UIStatusBarAnimation.None)
    
  2. You probably do too much init stuff in the viewDidLoad and that's why it lags a bit.

  3. You can use the

    @property (nonatomic, assign) CGFloat maximumLeftDrawerWidth;
    

    property to set the maximum width.

Majster
  • 3,611
  • 5
  • 38
  • 60
  • Thank you! My viewDidload for initial controller has only init method. Can you show where to put this code and also you may know how to write it in swift - i am very new to ios dev) – moonvader Apr 30 '15 at 06:59
  • I changed the answer so it shows the swift code for hiding the status bar. As for the lag, could you post some more code on what you're setting up in the drawer view? The lag occurs when you put too much work on the main thread so it's probably something that's expensive. – Majster Apr 30 '15 at 07:09
  • Can you tell me please how can I close the menu from the IBAction? I used this [app.drawerController toggleDrawerSide:MMDrawerSideLeft animated:true completion:nil]; but it's only open the menu – Ne AS Jan 22 '17 at 19:09
  • You use `[app.drawerController closeDrawerAnimated:YES completion:nil];` – Majster Jan 23 '17 at 07:10
0
  1. It might be due to navigation controllers of mmdrawer, for this you need to hide navigation bar of those controllers.

    [navigationController setNavigationBarHidden:YES];

    Swift version:

    navigationController?.setNavigationBarHidden(navigationController?.navigationBarHidden == false, animated: true)

    MMDrawer has three navigation controllers for Center, Right and left VCs so according to your usage you can hide nav bar for what navigation controllers you are using.

  2. This should work fine as you said it's working fine when you are opening view by sliding the screen, in my case its working fine for both the cases. As @Majster said "You probably do too much init stuff in the viewDidLoad and that's why it lags a bit." it might be the case.

  3. You can use

    [drawerController setMaximumRightDrawerWidth:[UIScreen mainScreen].bounds.size.width/4];
    for drawer to acquire 1/4 of screen.
pk75
  • 511
  • 7
  • 18
  • You need to put the code for hiding nav bar where you are initializing the MMDrawerController. – pk75 Apr 30 '15 at 07:50
  • i still have problems with 2) and my ViewController and it's viewDidLoad are default maybe there is some problem with loading method when it runs from toggleDrawerSide method? – moonvader May 08 '15 at 14:01