简体   繁体   English

RootViewController内有多个UIViewControllers

[英]Multiple UIViewControllers inside RootViewController

我有一个UIViewController,里面是RootViewController,存在一个UIView,其中包含另一个UIViewController,因为结构正确吗?

It could be correct if your RootviewController acts like a container view controller. 如果您的RootviewController像容器视图控制器那样工作,那可能是正确的。

check this doc on how to build that: 查看此文档,了解如何构建该文档:

Creating Custom Container View Controllers 创建自定义容器视图控制器

If you are using storyboard for your application and want to include several view controllers inside rootview controller better go for container controller which is there in Xcode itself. 如果您在应用程序中使用情节提要,并且希望在rootview控制器中包含多个视图控制器,则最好使用Xcode本身中的容器控制器。

If used container as a UIview controller for showing maps inside a view controller and other information related to that map was shown in the parent view controller i found it very useful and its reusable. 如果使用容器作为UIview控制器在视图控制器中显示地图,并且在父视图控制器中显示了与该地图有关的其他信息,我会发现它非常有用并且可重用。

You can check out the below link for further information 您可以查看以下链接以获取更多信息

https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/UsingViewControllersinYourApplication/UsingViewControllersinYourApplication.html https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/UsingViewControllersinYourApplication/UsingViewControllersinYourApplication.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM