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

No Root ViewController #63

Open
javagc opened this issue Aug 26, 2015 · 5 comments
Open

No Root ViewController #63

javagc opened this issue Aug 26, 2015 · 5 comments

Comments

@javagc
Copy link

javagc commented Aug 26, 2015

Hi, Thanks for this library, I have this scenario, first is login or register, after is home screen with slide menu, how can i use this library in this situation? i did it as home screen is launcher screen, thanks!

@mudithsilva
Copy link

i solved this, but i'm new to github , how can i upload my files ?

@javagc
Copy link
Author

javagc commented Sep 2, 2015

You can create fork of this project, make changes and then create pull request

@Jthami05
Copy link

@mudithsilva , did you ever create an example of a project with a login, and a slide menu attached to the home screen appearing after the login page? I can't get it, either the home screen is made the entry point in AppDelegate.swift, or the menu stops working after I leave the login page. Please help?

@mudithsilva
Copy link

Simply Check whether user logged in or not in the home screen. If not navigate to login page then dismiss the login page to view homepage.

 override func viewDidAppear(animated: Bool) {
    super.viewDidAppear(true)

    let prefs:NSUserDefaults = NSUserDefaults.standardUserDefaults()
    let isLoggedIn:Int = prefs.integerForKey("ISLOGGEDIN") as Int
    if (isLoggedIn != 1) {

        var storyboard = UIStoryboard(name: "Main", bundle: nil)
        let vc = storyboard.instantiateViewControllerWithIdentifier("ViewController") as! ViewController
        self.presentViewController(vc, animated: false, completion: nil)

        } else {

        }   
}

Then after the user insert correct information just dismiss the view controller easily

self.dismissViewControllerAnimated(true, completion: nil)

when log out , you should clear the NSUserDefaults, so In the logout function just inser this code for clear NSUserDefaults of the app

   NSUserDefaults.standardUserDefaults().removePersistentDomainForName(NSBundle.mainBundle().bundleIdentifier!)

@mohitkumat
Copy link

@javagc If you do not wan't to make it RootViewController, instead of adding these lines in AppDelegate:

let slideMenuController = SlideMenuController(mainViewController: mainViewController, leftMenuViewController: leftViewController, rightMenuViewController: rightViewController)
self.window?.rootViewController = slideMenuController
self.window?.makeKeyAndVisible()

you can add this in Login/Register success callback function:

let slideMenuController = SlideMenuController(mainViewController: mainViewController, leftMenuViewController: leftViewController, rightMenuViewController: rightViewController)
self.presentViewController(slideMenuController, 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

4 participants