Search code examples
iosipadsubmenu

Create a submenu iOS


I want to create a submenu that will appear right next to the first menu and that will contain more options. The first menu is hidden and only appears when a button its clicked on the navigation bar, i used the SWRevealViewController from github for the first menu, but i can't make the second one appear . Can somone help ? Thanks for any help in advance


Solution

  • Basically you add another SWRevealController as front view controller of the root SWRevealController.

    UIViewController *secondRearVC = // your second level menu controller
    UIViewController *secondVC = // your second level front view controller
    
    SWRevealViewController *childRevealController =
                [[SWRevealViewController alloc] initWithRearViewController:secondRearVC frontViewController:secondVC];
    
    [rootRevealController setFrontViewController:childRevealController animated:YES];
    

    You can find example of what I've suggested here.

    Other option is using other side menu controller, JASidePanels, if I'm not wrong it does what you want. Anyway you'll end up using some UIViewController containers recursively, so it's just a matter of choice.