Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.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 访问容器';自定义类中的父视图_Ios_Objective C_Uiviewcontroller_Uicontainerview - Fatal编程技术网

Ios 访问容器';自定义类中的父视图

Ios 访问容器';自定义类中的父视图,ios,objective-c,uiviewcontroller,uicontainerview,Ios,Objective C,Uiviewcontroller,Uicontainerview,我有一个自定义类myCustomClass,它是UIView的子类。我将添加一个UITextField作为子视图。然后,在情节提要中,我将UIView的类设置为自定义类 在故事板中,我有一个viewController和一个containerView。containerView连接到UITalbeViewController。UIView(我将其类设置为myCustomClass)位于tableViewController中 如何将文本字段添加为视图控制器的子视图?(我知道这有点复杂,所以如果您

我有一个自定义类
myCustomClass
,它是
UIView
子类。我将添加一个
UITextField
作为
子视图
。然后,在
情节提要
中,我将
UIView的
类设置为自定义类

在故事板中,我有一个
viewController
和一个
containerView
containerView
连接到
UITalbeViewController
UIView
(我将其类设置为
myCustomClass
)位于
tableViewController

如何将
文本字段
添加为
视图控制器
子视图
?(我知道这有点复杂,所以如果您有任何问题,请在评论中提问。)

编辑

这是我想要的。当您想将
子视图
添加到
父视图
时,可以执行以下操作:

[self.parentViewController.view addSubview:mySubview];

我想知道的是,在自定义类文件中是否有这样做的方法。

如果自定义类是UIView的子类,它可以完成常规UIView所能完成的一切

不能将子视图添加到viewController。将子视图添加到viewController的视图中。i、 e.[viewController.view addSubview]我一共有3个类。1-myCustomClass。2-UITableViewControllerClass。3-UIViewController。UITableViewControllerClass是嵌入式vc。我正在尝试将myCustomClass中的视图添加到UIVIewController的视图中。下面是一个测试项目,我正在研究将子视图添加到parentVC的方法。该方法如下:self.parentViewController.view addsubview:。但我正试图从一个自定义类中实现这一点。