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

Programmatically set controllers not working #24

Closed
valeIT opened this issue Feb 15, 2017 · 4 comments
Closed

Programmatically set controllers not working #24

valeIT opened this issue Feb 15, 2017 · 4 comments

Comments

@valeIT
Copy link

valeIT commented Feb 15, 2017

If I use storyboards everything works, if I instantiate it programmatically the controllers .revealViewController() is always nil and because of that it doesn't show the side controllers at all. Do I need to call something else after instantiation?

Repro:

Modify the Swift3 Example, at the bottom of "AppDelegate.swift" add these lines just before "return true":

let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "MainNC1") guard let finalVcLoggedIn = PBRevealViewController(leftViewController: UIViewController(), mainViewController: vc, rightViewController: UIViewController()) else { fatalError() } self.window?.rootViewController = finalVcLoggedIn self.window?.makeKeyAndVisible()

Go to the "Main.storyboard" file and change the main navigation controller identifier to "MainNC1".

Edit: The rest works correctly, if I save and instance of PBRevealViewController I can show and hide the side controllers, it's just the .revealViewController() that doesn't work.

@iDevelopper
Copy link
Owner

I have no problem with that:

PBRevealProgramExample.zip

@valeIT
Copy link
Author

valeIT commented Feb 16, 2017

Thanks, it works. My mistake.

@valeIT valeIT closed this as completed Feb 16, 2017
@iDevelopper
Copy link
Owner

Welcome!

@iDevelopper
Copy link
Owner

For other users, it could be great to know what was your mistake.

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

2 participants