您的位置:首页 > 产品设计 > UI/UE

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

2016-03-17 23:19 621 查看
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下载地址 欢迎收藏
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: