JVillella / JVFloatingDrawer

An easy to use floating drawer view controller.
MIT License
1.41k stars 158 forks source link

Calling Drawer after Login? #19

Open haleyngonadi opened 9 years ago

haleyngonadi commented 9 years ago

I'm having an issue calling this in a presentviewcontroller. I want the main view to resume after a user logs in but nothing happens:

SideViewController *about = [AppDelegate globalDelegate].drawerViewController; [self presentViewController:about animated:YES completion:nil];

SideViewController being a subclass of JVFloatingDrawerViewController!

dengpengks commented 9 years ago

you should register a notification, post a notification when you login.

carloskekwa commented 5 years ago

on LoginViewController :

AppDelegate *delegate = [AppDelegate globalDelegate];
[delegate InitDrawer];

in Appdelegate.m

// make the app enter the MainPage.
- (void)InitDrawer
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.rootViewController = self.drawerViewController;
    [self configureDrawerViewController];
    [self.window makeKeyAndVisible];
}
- (void)configureDrawerViewController {
    if ([[UtileFile getLanguagePhone] containsString:@"ar"]){
        self.drawerViewController.rightViewController = self.rightDrawerViewController;
        self.drawerViewController.centerViewController = self.drawerSettingsViewController;
        self.drawerViewController.animator = self.drawerAnimator;
        self.drawerViewController.backgroundImage = [UIImage imageNamed:@"drawerimg"];
    }else{
        self.drawerViewController.leftViewController = self.leftDrawerViewController;
        self.drawerViewController.centerViewController = self.drawerSettingsViewController;
        self.drawerViewController.animator = self.drawerAnimator;
        self.drawerViewController.backgroundImage = [UIImage imageNamed:@"drawerimg"];
    }

}
- (UITableViewController *)rightDrawerViewController {
    if (!_rightDrawerViewController) {
        _rightDrawerViewController = [self.drawersStoryboard instantiateViewControllerWithIdentifier:kJVRightDrawerStoryboardID];
    }
    return _rightDrawerViewController;
}