创建一个子菜单iOS

时间:2014-10-10 09:38:08

标签: ios ipad submenu

我想创建一个子菜单,它将出现在第一个菜单旁边,并且包含更多选项。第一个菜单是隐藏的,只有当它在导航栏上单击一个按钮时才显示,我使用github的SWRevealViewController作为第一个菜单,但是我无法显示第二个菜单。可以提供帮助吗? 感谢您提前提供任何帮助

2 个答案:

答案 0 :(得分:0)

对于这个效果,我创建了一个单独的视图,用UITableView初始化显示视图,起初我给该视图的零宽度和全高。如果按下导航按钮,我将主视图向右移动大约100px并将显示视图的宽度更改为100px,将该代码放在动画块中。

[UIView animateWithDuration:0.5 animations:^{
        //Move frame or transform view
        revealView.frame = CGRectMake(0,0,1,screenHeight);
        mainView.frame = CGRectMake(0, 0, 320, screenHeight);
    }];

答案 1 :(得分:0)

基本上,您添加另一个SWRevealController作为根SWRevealController的前视图控制器。

UIViewController *secondRearVC = // your second level menu controller
UIViewController *secondVC = // your second level front view controller

SWRevealViewController *childRevealController =
            [[SWRevealViewController alloc] initWithRearViewController:secondRearVC frontViewController:secondVC];

[rootRevealController setFrontViewController:childRevealController animated:YES];

您可以找到我建议here的例子。

其他选项是使用其他侧边菜单控制器JASidePanels,如果我没错,它会做你想要的。无论如何,你最终会递归地使用一些UIViewController容器,所以它只是一个选择问题。

相关问题