0

我在情节提要中有一个名为 A 的 UITableViewController,现在我试图在我的主视图控制器上滑入 A。

_vc = [self.storyboard instantiateViewControllerWithIdentifier:@"A"];

在我的showMenu方法中

[self addChildViewController:self.vc];
[self.view addSubview:self.vc.view];
[self.vc didMoveToParentViewController:self];

[UIView animateWithDuration:0.7 animations:^{
    [self.view setFrame:CGRectMake(160, 0, self.view.frame.size.width, self.view.frame.size.height)];
}];

我可以在视图控制器 A 中滑动。但是,无论我尝试对 AI 做什么,都没有响应。如何让 A 响应触摸事件?

4

1 回答 1

0

尝试这个,

self.viewControllerA = [self.storyboard instantiateViewControllerWithIdentifier:@"A"];
    [self.viewControllerA.view setFrame:CGRectMake(160, 0, self.view.frame.size.width, self.view.frame.size.height)];
    [self addChildViewController:self.viewControllerA];
    [self.view addSubview:self.viewControllerA.view];

    [UIView animateWithDuration:0.50f animations:^{
        [self.viewControllerA.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    } completion:^(BOOL finished) {
        [self.viewControllerA didMoveToParentViewController:self];
    }];
于 2013-10-09T06:33:38.337 回答