0

I am Using MMDrawerController in my Project. I followed this http://swiftdeveloperblog.com/left-side-menu-navigation-drawer-example-with-swift/ to set the MMDrawerController within my App. I used the same code in the tutorial in AppDelegate.swift file.

class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow? 

    var homeController : MMDrawerController?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.
        //NSNotificationCenter.defaultCenter().addObserver(self, selector: "detectRotation", name: UIDeviceOrientationDidChangeNotification, object: nil)



        _ = self.window!.rootViewController

        let mainStoryBoard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)

        let homeViewController = mainStoryBoard.instantiateViewControllerWithIdentifier("HomeViewController") as! HomeViewController
        let menuViewController = mainStoryBoard.instantiateViewControllerWithIdentifier("MenuViewController") as! MenuViewController

        let leftSideNavigation = UINavigationController(rootViewController: menuViewController);
        let homeNavigation = UINavigationController(rootViewController: homeViewController);

        homeController = MMDrawerController(centerViewController: homeNavigation, leftDrawerViewController: leftSideNavigation);


        homeController!.openDrawerGestureModeMask = MMOpenDrawerGestureMode.PanningCenterView
        homeController!.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.PanningCenterView


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

        window!.rootViewController =  homeController // current Entry point
        window!.makeKeyAndVisible();
        return true
    }
}

after setting the code when i run the app , the entry point of the app has changed to homeController (Home Screen that should appear only a user log's in or creates a new account)

I removed these lines from my AppDelegate File

window!.rootViewController =  homeController // current Entry point
            window!.makeKeyAndVisible();

So the app starts from the entry point that i have Set ie: the Login Page. But what happens now is the Drawer is Not showing on Pressing the Menu button (Hamburger). So what do i need to change/Add in-order to achieve my entry point and to make my drawer working ?

Joker
  • 830
  • 2
  • 14
  • 30
  • so what you want is when use logins then after app changes its starting point?? – Bhavin Bhadani Oct 14 '15 at 06:46
  • what i want is to have my Starting point as Login Page. When he log in he is directed to home page which has a menu button , on clicking the menu the Drawer shows. but now the entry point is Home Screen, Pls Check the Code – Joker Oct 14 '15 at 07:20
  • check my answer is same like what you said – Bhavin Bhadani Oct 14 '15 at 07:32
  • if set the my code like that will my Drawer work ? I Can set my Entry point to Login Page just by commenting/removing the line `window!.rootViewController = homeController` but then my drawer doesn't works. – Joker Oct 14 '15 at 08:38
  • yes...and don't comment that line – Bhavin Bhadani Oct 14 '15 at 09:23

0 Answers0