Ios 使用侧面板实现UITabbarcontroller的最佳方法是什么?

Ios 使用侧面板实现UITabbarcontroller的最佳方法是什么?,ios,uitabbarcontroller,Ios,Uitabbarcontroller,我想使用uitabbarcontroller实现侧栏(抽屉)。我已经使用lib JASidePanel实现了uiviewcontroller。但是我没有找到任何方法来实现uitabarcontroller 感谢您的帮助我正在使用MMDrawerController和TabBar作为侧栏 这是我初始化MMDrawer和tabBar的代码 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(N

我想使用uitabbarcontroller实现侧栏(抽屉)。我已经使用lib JASidePanel实现了uiviewcontroller。但是我没有找到任何方法来实现uitabarcontroller


感谢您的帮助

我正在使用MMDrawerController和TabBar作为侧栏

这是我初始化MMDrawer和tabBar的代码

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

[[MMExampleDrawerVisualStateManager sharedManager] setRightDrawerAnimationType:MMDrawerAnimationTypeParallax];

self.tabbarController = [[UITabBarController alloc] init];
self.tabbarController.delegate = self;

JSIntroViewController *obj_loginViewController = [[JSIntroViewController alloc] initWithNibName:@"JSIntroViewController" bundle:nil];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:obj_loginViewController];
self.navigationController.navigationBarHidden = YES;    

[self initializeTabBarControllerwithAnimation:FALSE];


UIViewController *rightViewController = [[JSMenuViewController alloc] init];

self.drawerController = [[MMDrawerController alloc]
                         initWithCenterViewController:self.navigationController
                         leftDrawerViewController:nil
                         rightDrawerViewController:rightViewController];
[self.drawerController setShowsShadow:NO];
[self.drawerController setRestorationIdentifier:@"MMDrawer"];
[self.drawerController setMaximumRightDrawerWidth:[UIScreen mainScreen].bounds.size.width-65];

[self.drawerController setGestureShouldRecognizeTouchBlock:^BOOL(MMDrawerController *drawerController, UIGestureRecognizer *gesture, UITouch *touch) {
    if([gesture isKindOfClass:[UITapGestureRecognizer class]])
        return YES;
    return NO;
}];
[self.drawerController
 setDrawerVisualStateBlock:^(MMDrawerController *drawerControllerr, MMDrawerSide drawerSide, CGFloat percentVisible) {
     MMDrawerControllerDrawerVisualStateBlock block;
     block = [[MMExampleDrawerVisualStateManager sharedManager]
              drawerVisualStateBlockForDrawerSide:drawerSide];
     if(block)
         block(drawerControllerr, drawerSide, percentVisible);
         }];
}
这是我初始化tabBar的方法

- (void)initializeTabBarControllerwithAnimation:(BOOL)animation
{
//First tab as Browse Job
JSBrowseViewController *obj_browseViewController =   [[JSBrowseViewController alloc] initWithNibName:@"JSBrowseViewController" bundle:nil];
//BrowseViewController *obj_browseViewController = [[BrowseViewController alloc] initWithNibName:@"BrowseViewController" bundle:nil];
UINavigationController *navi1 = [[UINavigationController alloc] initWithRootViewController:obj_browseViewController];
    navi1.navigationBar.translucent = NO;

//Second tab as Liked Job
LikedViewController *obj_likedViewController = [[LikedViewController alloc] initWithNibName:@"LikedViewController" bundle:nil];
UINavigationController *navi2 = [[UINavigationController alloc] initWithRootViewController:obj_likedViewController];
navi2.navigationBar.translucent = NO;

[self.tabbarController setViewControllers:[NSArray arrayWithObjects:navi1, navi2, nil]];
[self.tabbarController setSelectedIndex:0];

UITabBar *tabBar = self.tabbarController.tabBar;
tabBar.translucent = NO;
[tabBar setBackgroundColor:[UIColor whiteColor]];
UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0];
UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1];

[tabBarItem1 setTitle:@"BROWSE"];
[tabBarItem2 setTitle:@"LIKED"];    

[tabBarItem1 setImage:[[UIImage imageNamed:@"browser-icon"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[tabBarItem1 setSelectedImage:[[UIImage imageNamed:@"browser-sel-icon"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[tabBarItem2 setImage:[[UIImage imageNamed:@"like-icon"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[tabBarItem2 setSelectedImage:[[UIImage imageNamed:@"like-sel-icon"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];

selectedTabIndex = 0;
self.navigationController.navigationBarHidden = TRUE;
[self.navigationController pushViewController:self.tabbarController animated:animation];
}

使用MFSideMenu可在此处找到

它有很好的文档记录,并且支持UITabBarController。

您可以使用-它结构紧凑(仅2个文件),易于使用