浅谈UIViewController 使用-addChildViewController自定义视图控制器

View Controllers 是APP内在架构的基础,总体来讲一个APP的View Controllers 主要由以下两种设计而成:
There are two types of view controllers:

  • Content view controllers manage a discrete piece of your app’s content and are the main type of view controller that you create.

  • Container view controllers* collect information from other view controllers (known as child view controllers) and present it in a way that facilitates navigation or presents the content of those view controllers differently.

Most apps are a mixture of both types of view controllers.

第一种Content view controllers,上下文控制器,我喜欢叫导航控制器,它维护着一个视图控制器栈,通过push或者pop进行管理。
第二种Container view controllers,容器控制器,如tabbar view controller,本身作为parent view controller,拥有一个childViewControllers属性(NSArray* & read-only)。可以在 View Controller Programming Guide for iOS 了解详情。

Container view controllers功能很强大,我们可以利用它来自定义控制器,制作出如下所示的控制器效果:

这里写图片描述

Demo下载地址 欢迎收藏

发布了89 篇原创文章 · 获赞 37 · 访问量 9万+

猜你喜欢

转载自blog.csdn.net/u012891055/article/details/50918148
今日推荐