Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/115.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 将MVC组件的视图添加到另一个MVC组件_Ios_Swift_Model View Controller - Fatal编程技术网

Ios 将MVC组件的视图添加到另一个MVC组件

Ios 将MVC组件的视图添加到另一个MVC组件,ios,swift,model-view-controller,Ios,Swift,Model View Controller,我有一个自定义的UITableCell视图,需要向其中添加一个子视图。但是,该子视图是UIView子视图的一个实例,它有一个与之关联的UIViewController,我想继续使用MVC范式。如何才能成功添加此视图 谢谢当您将子视图添加到UITableViewCell时,您将留在MVC中 将子视图添加到UITableViewCell子类中,创建outlet并在ViewController中使用它。子视图是否包含对UIViewController的引用?@tailec它没有,但它可以,为什么?那么

我有一个自定义的
UITableCell
视图,需要向其中添加一个子视图。但是,该子视图是
UIView
子视图的一个实例,它有一个与之关联的
UIViewController
,我想继续使用MVC范式。如何才能成功添加此视图


谢谢

当您将子视图添加到
UITableViewCell
时,您将留在MVC中


将子视图添加到
UITableViewCell
子类中,创建outlet并在ViewController中使用它。

子视图是否包含对
UIViewController
的引用?@tailec它没有,但它可以,为什么?那么您的
UIViewController
是如何与子视图关联的呢?它通过故事板,
UIViewController
的视图出口连接到视图。