如何组合滑动菜单和uitabbarcontroller?

时间:2016-04-29 12:23:24

标签: ios objective-c uitabbarcontroller slidingmenu swrevealviewcontroller

我正在尝试将UITabBarController与滑动菜单集成。我正在使用SWRevealViewController来创建滑动菜单。

以下是我的故事板的图片。

enter image description here

TabView只对新闻有效。我希望它就像android一样的新视图。在android中我们可以结合导航抽屉和TabPager。 我怎么能在iOS中这样做?

1 个答案:

答案 0 :(得分:2)

尝试如下:

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