14

I have a viewController which contains a ContainerView(which is setting up a ViewController). I am setting up a segue and in prepareforsegue method I want to get a reference to a viewController which is embedded in the container View. How do I do that. I know that using segue.destinationViewController we can get a reference to UIViewController but I want to also setup the viewController that is being pointed to by the ContainerView.

4

1 回答 1

28

你已经有了答案。容器视图是视图,而不是视图控制器。它只是定义了嵌入 segue 将子视图控制器的内容视图放入的框架。

当系统创建子 VC 时,它会调用您的 prepareForSegue 方法,此时 segue.destinationViewController 将包含容器视图中包含的子视图控制器。

于 2013-09-07T12:36:36.153 回答