简体   繁体   English

如何在同一窗口中启用两个视图控制器

[英]How to enable two view controllers in the same window

I'm trying to develop a slide menu in my application which should open the menu view from the left (or the right) depending on the swipe direction. 我正在尝试在我的应用程序中开发一个幻灯片菜单,该菜单应根据滑动方向从左侧(或右侧)打开菜单视图。

What I did till now: 到目前为止,我所做的是:

1- Create a main View Controller A 1-创建一个主View Controller A

2- Create left (or right) View Controller B 2-创建左(或右)视图控制器B

3- When Slide button tapped, add B ViewController as a sub View for the A View Controller. 3-点击“滑动”按钮时,将B ViewController添加为A View Controller的子视图。 左滑菜单

4- here's my code: 4-这是我的代码:

CGRect currentLeftFrame  = self.leftVC.view.frame;
    currentLeftFrame.origin  = CGPointMake(-1.0f * self.view.frame.size.width, 0.0f);
    self.leftVC.view.frame   = currentLeftFrame;
    [self addChildViewController:self.leftVC];
    [self.view addSubview:self.leftVC.view];
    [self.leftVC didMoveToParentViewController:self];

The problem is that buttons in the B View controller are not clickable. 问题是B View控制器中的按钮不可单击。

Do one know how to solve this problem? 有人知道如何解决这个问题吗?

Thanks in advance. 提前致谢。

将UIView用于幻灯片面板,并将幻灯片视图添加为viewController的视图或应用程序窗口上的子视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM