How to use a 'Container View' in iOS?

允我心安 提交于 2019-11-27 03:23:51
Alladinian

Well let's break this into some simple steps:

  1. Drag a container view to the main view of one of your controllers. When you drag the container view, IB will create an embed segue for you and you can resize the container's view by dragging the resize control points as usual. Any changes in the size will be automatically reflected to the view that the segue is pointing to. The idea is that this view will be managed by a different controller, the embedded one.

  2. Set your custom subclass as the class of the embedded controller.

  3. Now you're good to go. Note that any containers you add will be available through the childViewControllers property on your main controller.

This is obviously an oversimplified workflow but it's enough to get you started. For more information on the subject, see Apple's documentation here.

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