Created
January 6, 2012 08:51
-
-
Save liwh/1569769 to your computer and use it in GitHub Desktop.
ios mvc design patten
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Model: 代表你的应用程序是什么(不是怎么展现) | |
Controller: 控制你的Model怎么展现给用户(UI逻辑) | |
View: Controller的奴隶。。。 | |
Model,Controller,View相互通讯的规则: | |
Controller可以直接和Model通信 | |
Controller也可以直接和View通信 | |
Model和View永远不能直接通信 | |
iOS中View和Controller的通信是透明和固定的,主要通过outlet和action实现 | |
View使用Delegate接口和Controller同步信息 | |
View不直接和数据通信,使用dataSource接口从Controller处获取数据 | |
View的delegate和dataSource一般就是Controller | |
Controller负责为View翻译和格式化Model的数据 | |
Model使用Notification & KVO的方式分发数据更新信息,Controller可以有选择的监听自己感兴趣的信息。 | |
View也可以监听广播信息,但一般不是Model发出的信息 | |
一个完整的App就是很多MVC的集合 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment