本文来自于View controller programming guide for ios,仅供自我学习之用,如果能够帮到诸位,最好不过。
About view controller
view controller 是一个在app's data和可视化外观之间的至关重要的link。无论app什么时候显示user interface,显示的内容都是在view controller的控制管理之下的,或者在多个view controller之间协调管理之下的
在构建app中view controller提供了骨骼framework
ios 提供许多已经构建好的view controller类去支持标准的user interface,从开发app开始,你就需要custome一个或多个view controller去显示特定的内容
At a Glance
view controller 是在MVC设计模式中一个传统的 controller对象,view controller提供在ios app中所有的常见的行为,通常这些行为被构建在基本的class中,对一些行为,based class提供了解决方法中的一部分,其他的有custom 的view controller去实现A View Controller Manages a Set of Views
a view controller管理你的app user interface中不相关的部分,根据需要,他让view去显示或者交互,view是分层的You Manage Your Content Using Content View Controllers
Container View Controllers Manage Other View Controllers
container view controllers显示被别的view controllers所拥有的内容,这些别的view controllers与container view controller有着明确的关系,叫做parent- child relationshipcontainer和content view controller的结合用一个单root view controller创建了一个view controller的分层结构,
每种类型的container都定义了自己的interface去管理他的child.the containers的方法有时候在他的child之间定义了特定的导航关系
Presenting a View Controller Temporarily Brings Its View Onscreen
有时候,一个view controller需要显示额外的信息给用户,或者想要用户去提供额外的信息,但由于屏幕的空间是有限的,不可能同时显示所有的user interface elements,所以ios app临时显示另外一个view去和用户交互,这个view将一直显示知道用户完成了请求的行为ios 允许一个view controller去呈现另外一个view controller的内容