How do I add MMDrawerController only to one tab of TabBarController?

233 Views Asked by At

I'm using a Tabbarcontroller and I want a side menu in the first tab of the tab bar. For the side menu I'm using MMDrawerController.

I'm using storyboard

How should I proceed ?

1

There are 1 best solutions below

0
Devendra Singh On

Following code is working for me, I have written this code in viewDidload of LoginScreen, In Storyboard i have created LoginScreen as rootviewController with embeded navigationController (means navigationController is storyboard entry point and LoginScreen is rootViewController).

UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; UIViewController *vcSideMenu = [storyBoard instantiateViewControllerWithIdentifier:@"SideMenuScreen"]; UITabBarController *tabBar = [storyBoard instantiateViewControllerWithIdentifier:@"tabBar"]; MMDrawerController *controller = [[MMDrawerController alloc] initWithCenterViewController:tabBar leftDrawerViewController:vcSideMenu rightDrawerViewController:nil]; CGFloat menuWidth = [UIScreen mainScreen].bounds.size.width * 0.8; [controller setMaximumLeftDrawerWidth:menuWidth]; [controller setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeNone]; [controller setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll]; [self.navigationController pushViewController:controller animated:NO];