简体   繁体   中英

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

2- Create left (or right) View Controller B

3- When Slide button tapped, add B ViewController as a sub View for the A View Controller. 左滑菜单

4- here's my code:

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.

Do one know how to solve this problem?

Thanks in advance.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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