Programming in iOS with Objective-C Using MVC

1 篇文章 0 订阅

Programming in iOS with Objective-C Using MVC
今天开始学习Stanford University 的公开课 —– CS193P iPhone Development Course by Stanford University。 此博文主要记录MVC相关的基础知识。
MVC not a programming language ,not a platform . It is a Software Architecture Design Pattern.
MVC is the Blueprint of a software development project.
MVC is abbreviated to Model ,View ,Controller .
Objective-C is built upon MVC Design pattern. Apple expects all the iOS programmers to follow this programming architecture pattern.

What is MVC ?

Model – What your application is about? (Data,Logical ,Rules)

这里写图片描述

Controller – How you present your application (model) to the end users?

这里写图片描述

View – The interface which the end users see.

这里写图片描述

How they interact with each other ?

这里写图片描述

这里写图片描述

这里写图片描述

View 没有数据;View 只能通过controller和model进行数据交互;Controller 能够直接与View 和Model 进行交互。下面一张来自apple官方的介绍MVC如何交互的图片:

这里写图片描述

View 可以通过如下方式和Controller 进行交互:

a. Target-Action (eg: buttons)

b. Delegate (Will, Did, Should)
这里写图片描述

c. Data Source (data at, count)
这里写图片描述

这里写图片描述

**重点内容**Model 只能通过下面的两种方法与Controller 进行交互:

a. Notifications

b. KVO (Key-Value Observing)
这里写图片描述

Advantages of MVC ?

IOS Four Layer

Core OS
这里写图片描述

Core Services
这里写图片描述

Media
这里写图片描述

Cocoa Touch
这里写图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值