Ios 添加childContainerView将禁用UITableView
我有一个聊天设置为UIViewController,并在其视图中添加了一个tableView。这很好用。此后,我对该viewController进行了子类化,并添加了一个childViewController作为表的标题:Ios 添加childContainerView将禁用UITableView,ios,objective-c,uitableview,childviewcontroller,Ios,Objective C,Uitableview,Childviewcontroller,我有一个聊天设置为UIViewController,并在其视图中添加了一个tableView。这很好用。此后,我对该viewController进行了子类化,并添加了一个childViewController作为表的标题: - (void) createClassVideoView { CGRect rect = CGRectMake(0.0f, 0.0f,
- (void) createClassVideoView {
CGRect rect = CGRectMake(0.0f,
0.0f,
self.view.frame.size.width,
kWSClassVideoHeight);
WSClassVideoController *classVideoController = [[WSClassVideoController alloc] initWithFrame:rect mainUser:[[WSConversationManager shared] teacherObject] secondaryUsers:[[WSConversationManager shared] students]];
[self addChildViewController:classVideoController];
[self.view addSubview:classVideoController.view];
[classVideoController didMoveToParentViewController:self];
self.classVideoController = classVideoController;
}
它未设置为实际的tableHeaderView
。它只是作为childViewController添加到聊天视图控制器的子类中,我刚刚重置了tableView的框架以容纳它。此“标题视图”工作正常,并可接收触摸
但是,它已经禁用了超类tableView的触摸功能。tableView会显示,但我无法滚动它,点击UITextField不会有任何作用。您不能将视图控制器添加为其他视图控制器的子视图。@Nikita,您当然可以。你认为addChildViewController:方法有什么作用?@rdelmar你可以,但这可能不是OP想要做的……你从未设置classVideoController视图的帧。你不想把它设为rect吗?如果你这样做,会有帮助吗?@Paulw11,你为什么这么认为?这就是他所说的他正在努力做的。