Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Hashir524 opened this issue Feb 19, 2019 · 3 comments
Open

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

Hashir524 opened this issue Feb 19, 2019 · 3 comments

Comments

@Hashir524
Copy link

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.

@Hashir524
Copy link
Author

Any Help Would be much Appreciated. :)

@ChetanRajagiri
Copy link

@Hashir524 any update on this?

@tsaromkar
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants