unable to use UITabBarController with Sliding Side Menu

老子叫甜甜 提交于 2019-12-12 04:10:58

问题


Im trying to combine both UITabBarController and Sliding Side Menu.

For Sliding Side menu, Im using SWRevealViewController

Im successful in creating the sliding menu but Im not be able to include How can I integrate the UITabBarController with SWRevealViewController or is there any other way through which I can incorporate UITabBarController with Sliding Side Menu?


回答1:


Well, you set your tab bar controller as the reveal view controller's front controller, so of course the tab bar controller goes to the right when you reveal your rear controller !!.

Option A:

Managed to integrate it. Below are the steps to do it:

A. Add a new UIViewController to the storyboard.

B. Remove the content view from the newly added UIViewController

C. Make sure "Is Initial View Controller" is checked in IB for the newly added UIViewController.

D. Set the custom class for the newly added UIViewController to SWRevealViewController.

E. Connect it to a view controller that you intend to be the rear view controller - give the segue "sw_rear" identifier in IB. This must be a reveal controller segue type.

F. Connect it to the UITabBarController - give the segue "sw_front" identifier in IB. This must be a reveal controller segue type.

Option B:

MainTabViewController *frontViewController = [[MainTabViewController alloc] init];
RearViewController *rearViewController = [[RearViewController alloc] init];

UINavigationController *frontNavigationController = [[UINavigationController alloc] initWithRootViewController:frontViewController];
UINavigationController *rearNavigationController = [[UINavigationController alloc] initWithRootViewController:rearViewController];

SWRevealViewController *revealController = [[SWRevealViewController alloc] initWithRearViewController:rearNavigationController frontViewController:frontNavigationController];
revealController.delegate = self;

self.viewController = revealController;
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];           


来源:https://stackoverflow.com/questions/36932069/unable-to-use-uitabbarcontroller-with-sliding-side-menu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!