我正在使用 Tabbarcontroller ,我想在标签栏的第一个标签页中找到侧边菜单。对于侧边菜单,我正在使用 MMDrawerController 。
我正在使用故事板
我该怎么办?
答案 0 :(得分:0)
以下代码对我有用,我在LoginScreen的viewDidload中编写了这段代码,在Storyboard中我创建了LoginScreen作为rootviewController,带有embeded navigationController(表示navigationController是storyboard入口点,LoginScreen是rootViewController)。
UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@“Main”bundle:nil]; UIViewController * vcSideMenu = [storyBoard instantiateViewControllerWithIdentifier:@“SideMenuScreen”]; UITabBarController * tabBar = [storyBoard instantiateViewControllerWithIdentifier:@“tabBar”]; MMDrawerController * controller = [[MMDrawerController alloc] initWithCenterViewController:tabBar leftDrawerViewController:vcSideMenu rightDrawerViewController:nil]; CGFloat menuWidth = [UIScreen mainScreen] .bounds.size.width * 0.8; [controller setMaximumLeftDrawerWidth:menuWidth]; [controller setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeNone]; [controller setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll]; [self.navigationController pushViewController:controller animated:NO];