0

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 ?

Santo
  • 1,611
  • 3
  • 17
  • 37
Akshay Yerneni
  • 103
  • 2
  • 11
  • tab.selectedIndex == 0, add/show the tab bar else hide it from the view. – Santo Mar 17 '17 at 09:49
  • I have written the code in appdelegate. In the code, it asks me to set a root view controller while doing alloc/init for uinavigationcontroller. If I'm setting the center view controller as root the tab bar isn't working and if I'm setting the tab bar as the root, side menu is being implemented in all the viewcontrollers in tab bar. – Akshay Yerneni Mar 17 '17 at 10:04
  • In Viewcontroller's viewWillAppear, hide the side where you dont need it. – Santo Mar 17 '17 at 10:09

1 Answers1

0

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];

Devendra Singh
  • 717
  • 1
  • 13
  • 14