01-Stanford-Overview of iOS & MVC 摘要及筆記

一.  iOS的總體架構圖數據庫

 

<1>Cocoa Touch 設計模式

該層提供了構建iOS應用的一些基本系統服務(如多任務、觸摸輸入、推送通知)和關鍵框架。架構

<2>Mediaapp

Media層提供了圖形、音頻、視頻、Aiplay技術。框架

<3>Core Servicesui

該層提供了iCloud、應用內購買、SQLite數據庫和XML支持技術。atom

<4>Core OSspa

該層提供了一些低級功能(如管理證書重力加速計等),開發中通常不直接使用它。設計

 

二.  MVC3d

MVC Design Strategies(網上關於MVC是否爲設計模式多種爭論,可是在蘋果官網的《Start Developing iOS Apps Today》一文設計模式一章,明確指出了MVC爲設計模式)

<1>Model 

What your application is (but not how it is displayed).

<2>View

Your Controller's minions.

<3>Controller

How your Model is presented to the user(UI logic).

Controllers can always talk directly to their Model and View.

* View怎樣和Controller通訊

3.11 View指向Controller的Communication is 「blind」 and structured. 

3.12 The Controller can drop a target on itself,then hand out an action to the View,the View sends the action when things  happen in the UI.

3.13 Sometimes the View needs to  synchronize with the Controller.   The Controller sets itself as the View's delegate ,the delegate is set via a protocol(it is "blind" to class)                                              blind意指什麼--->?

3.14 Views do not own the data they display

  if need , views have a protocol to acquire it.Controllers are almost always that data source(not Model);  Controllers interpret/format Model information for the View.

 

* Model怎樣和Controller通訊

3.21 The Model is (should be) UI independent

3.22 Model uses a"radio station"-like broadcast mechanism.

3.23 Controllers (or other Model) "tune in" to interesting stuff.                    ---->? 

3.24 A View might "tune in",but probably not to a Model's "station"                  ---->? 

 

三.  Objective-C

完整代碼

 

1. properties

Usually we do not access instance variables directly in Objective-C . Instead,we use "properties" .

A"property" is just the combination of a getter method and a setter method in a class.

 

2.

*類是公共的聲明,私有的實現

 

*在聲明文件中聲明的方法是公共的

*能夠在實現文件的聲明部分進行私有方法的聲明。

*在實現文件的實現部分直接實現的方法, 而沒有在其餘任何地方聲明的也是私有的方法

3.

在iOS7中,能夠用 @import Foundation; (注意句末的分號) 代替   #import <Foundation/Foundation.h>

4.

iOS不直接擁有實例變量;指針;堆;公共方法的聲明

 

5.strong 、weak和nonatomic

6.基本數據類型 BOOL

7.getter方法的重命名

8.isEqualToString:

9.快速枚舉

相關文章
相關標籤/搜索