Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.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
Objective c UIViewController的视图层次结构_Objective C_Ios_Cocoa Touch_Ipad_Uiviewcontroller - Fatal编程技术网

Objective c UIViewController的视图层次结构

Objective c UIViewController的视图层次结构,objective-c,ios,cocoa-touch,ipad,uiviewcontroller,Objective C,Ios,Cocoa Touch,Ipad,Uiviewcontroller,在我的ContainerViewController中,我添加了scrollView作为子视图。在该scrollView中,我添加了ImageViewController的视图作为子视图。现在我应该将ImageViewController作为子视图控制器添加到ContainerViewController吗?没有“子视图控制器”的概念。您只需要设置视图的层次结构,并让视图控制器控制视图的行为。您不需要为基本的UIViewController再次添加UIImageView 在层次结构上,您创建了第

在我的ContainerViewController中,我添加了scrollView作为子视图。在该scrollView中,我添加了ImageViewController的视图作为子视图。现在我应该将ImageViewController作为子视图控制器添加到ContainerViewController吗?

没有“子视图控制器”的概念。您只需要设置视图的层次结构,并让视图控制器控制视图的行为。

您不需要为基本的
UIViewController
再次添加
UIImageView

在层次结构上,您创建了第一个
UIViewController
,并为其
UIView
添加了
uicrollview
作为子视图,并向
uicrollview
添加了
UIImageView

这太完美了

试着把它们想象成盒子里的一双鞋(
UIImageView
uicrollview
抽屉里有什么(
UIViewController


如果你以前把装有鞋子的盒子放进抽屉里,你就不需要再把鞋子放进抽屉里;因为你的鞋子已经在抽屉里,在盒子里了。

你想做什么。在ios 5.0中,我想添加一个ImageViewController,它是UIViewController的子类。不是UIImageView。在这种情况下,必须将继承的
UIViewController
类的
UIView
属性作为子视图添加到
UIScrollView
中。无论继承类的当前名称是什么,过程和逻辑都是相同的。