Open javagc opened 9 years ago
i solved this, but i'm new to github , how can i upload my files ?
You can create fork of this project, make changes and then create pull request
@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?
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!)
@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)
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!