Skip to content

Drawer View is not opening,When coming from another screen #138

Open

Description

@Hashir524

I will Explain my Problem alittle bit. So i am not initialising drawerview in Appdelegate. instead i am initialising the drawer view in my loginView Controller and Setting the rootViewController From there. Everything is Working fine. But when i go to the other ViewControllers and comeback to the drawer screen through a segue it won't work from here. I tried to reiniallize the drawerview and set the rootController again. but it also didn't work. i will attach my code

App Delegate File Code.

                  var window: UIWindow?
                  var drawerController = KYDrawerController.init(drawerDirection: .left, drawerWidth: 300)

Login Screen Code. Where i am Iniallizing the drawer view

                 let appDel = UIApplication.shared.delegate as! AppDelegate
                 let mainVc = self.storyboard?.instantiateViewController(withIdentifier: "Tabs")
                 let drawerVc = self.storyboard?.instantiateViewController(withIdentifier: "Drawer")
                
                 let tabbarController = mainVc as? UITabBarController
                 let nextScene = tabbarController?.viewControllers![0] as! MapViewTabViewController
                 nextScene.loginResponse = self.loginResponseglobal
                 let nextListScene = tabbarController?.viewControllers![1] as! 
                  ListViewDashboardViewController
               
                 appDel.drawerController.mainViewController = mainVc
                 appDel.drawerController.drawerViewController = drawerVc
                 appDel.window?.rootViewController = appDel.drawerController
                 appDel.window?.makeKeyAndVisible()

For the First time it was working. but unfortunatly it is not working when i come from another screen. except LoginScreen. AnyHelp would be appreciated. as i am started in ios.

Activity

  1. Hashir524 commented on Feb 19, 2019

    @Hashir524
    Author

    Any Help Would be much Appreciated. :)

  2. ChetanRajagiri commented on May 10, 2020

    @ChetanRajagiri

    @Hashir524 any update on this?

  3. tsaromkar commented on Jul 25, 2020

    @tsaromkar

    I did it using storyboard, mine wasn't opening too, while the implementation remains the same, on the login screen instead of

    let vc = UIStoryboard.init(name: "Main", bundle: Bundle.main).instantiateViewController(withIdentifier: "dashboardMenuViewController") as? DashboardMenuViewController
    self.navigationController?.pushViewController(vc!, animated: true)

    I used this and it worked:
    let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
    let nextViewController = storyBoard.instantiateViewController(withIdentifier: "kyDrawerController") as! KYDrawerController
    self.present(nextViewController, animated:true, completion:nil)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions