Can I create a UIContainerView programmatically?

两盒软妹~` 提交于 2019-12-03 05:47:44
Simon McLoughlin

A UIContainerView is just a visual way to add a viewController as a child of another and setting its bounds.

You can do this programatically by adding the second viewController as a child of the first, taking the second's view and placing it somewhere on the first's view.

Something like this;

childVC = [[SomeViewController alloc] init];

[self addChildViewController:childVC];

[self.view addSubview:childVC.view];

[childVC didMoveToParentViewController:self];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!