0

i am beginner iOS dev, I have my app with many controllers. After login on LoginViewController (LoginViewController has segue relation with NavigationViewController) I do init MMDrawerViewController with this code:

-(void)initSidebarController{
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

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

    UIViewController *leftView = [mainStoryboard instantiateViewControllerWithIdentifier:@"LeftViewController"];
    UIViewController *centerView = [mainStoryboard instantiateViewControllerWithIdentifier:@"CenterViewController"];


    UINavigationController *leftNav= [[UINavigationController alloc]initWithRootViewController:leftView];
    UINavigationController *centerNav= [[UINavigationController alloc]initWithRootViewController:centerView];

    appDelegate.drawerController= [[MMDrawerController alloc]initWithCenterViewController:centerNav leftDrawerViewController:leftNav];

    appDelegate.drawerController.openDrawerGestureModeMask = MMOpenDrawerGestureModePanningCenterView;
    appDelegate.drawerController.closeDrawerGestureModeMask = MMOpenDrawerGestureModePanningCenterView;

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

Now I want to push DishesViewController on NavigationViewController when user didSelectRowAtIndexPath . How can I do this correctly ?

enter image description here

enter image description here Thanks

Boris Kuzevanov
  • 1,232
  • 1
  • 12
  • 21

2 Answers2

0

Go to the storyboard, select dishesViewController and select the identity inspector from the left pane and in the StoryboardID enter "dishesVC" then use this code :

CateringDishesViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"dishesVC"];
    [self.navigationController pushViewController: animated:YES]
Shahzaib Qureshi
  • 989
  • 8
  • 13
0

Please follow below step, I am sure it will work for you.

1) Get top ViewController (Reference link).

2) If your MMDrawerController library configure is proper then you will get MMDrawerController as a top view controller.

3) Then find center UINavigationController

4) By using center navigation controller you can to new view controller into stack.

If you don't able to do it then provide sample source code with us. So we can provide exact solution.

Hitesh Surani
  • 12,733
  • 6
  • 54
  • 65