Search code examples
iosiphoneswiftmmdrawercontroller

How to configure MMDrawerController properly


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.


Solution

    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.