Reputation: 464
I would like to implement a side menu bar in my application, I have UITabBarController
and Storyboard
, I have tried to integrate the menu bar MFSideMenu
, but there is not a menu with UITabBarController
for storyboard, just for nib files, so I need your help.
Many thanks
Upvotes: 0
Views: 872
Reputation: 4271
You simply do the following:
UIStoryboard
instance of the the relevant storyboard you need to set as the center controller, in case you have multiple storyboards. Use HomeStoryboard
if you have just the standard storyboard in use.initial view controller
of your app, based on it's storyboard ID. You will have to set this in Storyboard (utilities pane).MFSideMenuContainerViewController
, with the center and left(or right, or both) menu controller you just created.MFSideMenuContainerViewController
as the rootViewController
of your app window.Sample code:
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"HomeStoryboard" bundle:nil];
UIViewController *homeViewController = [sb instantiateViewControllerWithIdentifier:@"homeViewController"];
UIViewController* leftMenuViewController = ......//Instantiate your left menu controller
MFSideMenuContainerViewController *container = [MFSideMenuContainerViewController
containerWithCenterViewController:homeViewController
leftMenuViewController:leftMenuViewController
rightMenuViewController:nil];
self.window.rootViewController = container;
[self.window makeKeyAndVisible];
Upvotes: 4