如何将侧边栏添加到self.viewcontroller
以初始化内容。
self.viewController
是一个rootViewController
- (void)setupViewControllers {
UIViewController *firstViewController = [[BdbHomeListViewController alloc] init];
UIViewController *firstNavigationController = [[UINavigationController alloc]
initWithRootViewController:firstViewController];
UIViewController *secondViewController = [[BdbExpiredListViewController alloc] init];
UIViewController *secondNavigationController = [[UINavigationController alloc]
initWithRootViewController:secondViewController];
UIViewController *thirdViewController = [[BdbHistoryListViewController alloc] init];
UIViewController *thirdNavigationController = [[UINavigationController alloc]
initWithRootViewController:thirdViewController];
UIViewController *forthViewController = [[BdbChatRoomListViewController alloc] init];
UIViewController *forthNavigationController = [[UINavigationController alloc]
initWithRootViewController:forthViewController];
UIViewController *fithViewController = [[RightViewController alloc]init];
UIViewController *fithNavigationController = [[UINavigationController alloc]
initWithRootViewController:fithViewController];
RDVTabBarController *tabBarController = [[RDVTabBarController alloc] init];
[tabBarController setViewControllers:@[firstNavigationController, secondNavigationController,
thirdNavigationController,forthNavigationController,fithNavigationController]];
TheSidebarController *sidebar = [[TheSidebarController alloc] initWithContentViewController:self.viewController rightSidebarViewController:fithNavigationController];
self.viewController = tabBarController;
[self customizeTabBarForController:tabBarController];
}
答案 0 :(得分:0)
我认为你应该这样做:
TheSidebarController *sidebar = [[TheSidebarController alloc] initWithContentViewController:tabBarController rightSidebarViewController:fithNavigationController];
self.window.rootViewController= sidebar;
[self.window makeKeyAndVisible];
你也不需要这个:
self.viewController = tabBarController;