Why isn't the side menu opening the second time I use it ? (MMDrawerController + UITabBarController)

92 Views Asked by At

I have a table view in my side drawer. When I tap on one of the cells, everything opens and works fine. Now the second time when I try to open the side drawer, it wont open (even if I try to tap on the button or swipe right). The side menu is working only once. How can I resolve this issue ?

Code I used in AppDelegate -

-(void)slideOutMenu{

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

TabBarController *centerPage = [storyboard instantiateViewControllerWithIdentifier:@"TabBar"];
RightSlideMenu *rightSideMenu = [storyboard instantiateViewControllerWithIdentifier:@"RightMenu"];

UINavigationController *centerNav = [[UINavigationController alloc] initWithRootViewController:centerPage];
UINavigationController *rightNav = [[UINavigationController alloc] initWithRootViewController:rightSideMenu];

self.drawerController = [[MMDrawerController alloc] initWithCenterViewController:centerNav rightDrawerViewController:rightNav];

self.drawerController.openDrawerGestureModeMask = MMOpenDrawerGestureModePanningCenterView;
self.drawerController.closeDrawerGestureModeMask = MMCloseDrawerGestureModeAll;

self.window.rootViewController = self.drawerController;
[self.window makeKeyAndVisible];
}

I've also tried implementing the code in the class for tabbarcontroller, but then mmdrawer isn't opening at all.

thanks in advane

akshay

1

There are 1 best solutions below

0
NAVEEN KUMAR On

when click on the cell. u need to set "your resultentVC" as a center page of ur MMDrawerContoler.

please check this :

    AppDelegate *app = (AppDelegate*)[[UIApplication sharedApplication]delegate];

resultentVC *res = [self.storyboard instantiateViewControllerWithIdentifier:@"resVC"];
            UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:res];
            [app.drawer setCenterViewController:nav withCloseAnimation:true completion:nil];

      [app.drawer setCenterViewController:nav withCloseAnimation:true completion:nil];