选项卡单击应打开滑块菜单目标 c
Posted
技术标签:
【中文标题】选项卡单击应打开滑块菜单目标 c【英文标题】:tab click should open the slider menu objective c 【发布时间】:2016-04-21 05:57:14 【问题描述】:我想在 tabview 控制器中集成滑块菜单。
Explanation :
-I have application which have 4 tabbutton.
-There is not slide menu in 1,2,and 3rd button
-When user click on the 4th tab button right side slider menu will open
-When i click any of the items inside the slide menu it will allow be to open any viewcontroller .
我试过的代码是:
//TABVIEW CONTROLLER
self.tabBarController = [[UITabBarController alloc] init];
HomeViewController *VC1 = [[HomeViewController alloc] init];
VC1.title = @"home";
UINavigationController *VC1Navigation = [[UINavigationController alloc]
initWithRootViewController:VC1];
timelineViewController *VC2 = [[timelineViewController alloc] init];
VC2.title = @"Timeline";
UINavigationController *VC2Navigation = [[UINavigationController alloc]
initWithRootViewController:VC2];
messageViewController *VC3 = [[messageViewController alloc] init];
VC3.title = @"message";
UINavigationController *VC3Navigation = [[UINavigationController alloc]
initWithRootViewController:VC3];
calenderViewController *VC4 = [[calenderViewController alloc] init];
VC4.title = @"calender";
UINavigationController* VC4Navigation = [[UINavigationController alloc]
initWithRootViewController:VC4];
slideViewController *VC5 = [[slideViewController alloc] init];
VC5.title = @"profile";
UINavigationController* VC5Navigation = [[UINavigationController alloc]
initWithRootViewController:VC5];
NSArray* controllers = [NSArray arrayWithObjects:VC1Navigation, VC2Navigation, VC3Navigation,VC4Navigation,VC5Navigation, nil];
self.tabBarController.viewControllers = controllers;
对于滑块菜单,我正在使用代码:https://github.com/SocialObjects-Software/AMSlideMenu 注意:我不是 .storyboard。我更喜欢在这个项目中使用 XIB。
请指导我。谢谢。
【问题讨论】:
【参考方案1】:展示您的主主视图控制器(即滑块菜单的第一个视图控制器)。在 viewDidAppear 中,您可以调用左栏菜单按下按钮操作,这将打开您的滑块。
如果您不希望默认打开滑块菜单中的第一个视图控制器,请添加一个将打开的虚拟空白视图控制器。你可以有基本的标志或图像(就像我们在启动屏幕上一样)。
【讨论】:
感谢您的快速回复。是否可以在应用程序中打开任何视图控制器的顶部打开幻灯片? 创建自定义导航栏,左侧栏按钮项为“菜单按钮”。在这个自定义导航类中;您可以让 IBAction Outlet 调用您的菜单滑块。以上是关于选项卡单击应打开滑块菜单目标 c的主要内容,如果未能解决你的问题,请参考以下文章