我在故事板中有一个名为A的UITableViewController,现在我尝试在我的mainviewcontroller上滑动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)];
}];
我可以在viewcontroller A中滑动。但无论我尝试用A做什么,我都没有得到回应。如何让A响应触摸事件?
答案 0 :(得分: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];
}];