JASidePanel与UITabBarController一起工作



我正在使用JaSidePanel作为应用程序。我想在UITabBarController的一个选项卡中打开一个Sidepanel,然后像 facebook 一样隐藏选项卡栏,但只能在三个选项卡之一中。

在应用程序中登录后。此时将显示一个包含三个选项卡的TabBarController。在这三个选项卡之一中,我想显示一个侧面板来执行过滤器请求,如果我将JaSidePanelController添加到选项卡控制器,我可以这样做,但我无法隐藏选项卡栏。另一种选择是将所有ViewController存储在NavigationController中,并将此导航存储在JaSidePanelController.centerPanel = navigationController;中,但是在每个选项卡中,我可以打开侧面板并看到打开的侧面板按钮。我试图隐藏按钮,但我不能。知道吗?

这是我的代码,我使用的是第二个选项:

UITabBarController *tabBarController = [[UITabBarController alloc] init];
WPPlansViewController *plansVC = [[WPPlansViewController alloc] init];
plansVC.title = @"Mis planes";
WPStoreListViewController *sherpaVC = [[WPStoreListViewController alloc] init];
sherpaVC.title = @"Be Sherpa";
WPProfileViewController *profileVC = [[WPProfileViewController alloc] init];
profileVC.title = @"Perfil";
[tabBarController setViewControllers:@[plansVC,sherpaVC,profileVC]];
[tabBarController setSelectedIndex:1];
JASidePanelController *jaSidePanelVC = [[JASidePanelController alloc] init];
jaSidePanelVC.shouldDelegateAutorotateToVisiblePanel = NO;
jaSidePanelVC.leftPanel = [[WPFilterSidePanelViewController alloc] init];
UINavigationController *nav4 = [[UINavigationController alloc] initWithRootViewController:tabBarController];
nav4.navigationBar.topItem.title = nil;

jaSidePanelVC.centerPanel = nav4;
jaSidePanelVC.rightPanel = nil;
[self presentViewController:jaSidePanelVC animated:NO completion:nil];

为什么不能隐藏标签栏?在 UITabBarController 中(子类化它),将 self.tabBar 的框架更改为离开屏幕,如下所示:

[UIView animateWithDuration:0.3 animations:^{
            [self.tabBar setFrame:CGRectMake(self.tabBar.frame.origin.x, self.view.frame.size.height, self.tabBar.frame.size.width, self.tabBar.frame.size.height)];
    }];

您可以在显示侧面板时隐藏选项卡栏。

关于按钮,也许您指的是 leftButtonForCenterPanel ,您可以在需要时轻松将其删除。

最新更新