斯坦福ios开发第一课:class logistics, overview of ios, MVC, Objective-C

Core OS: 

Mach是一个由卡内基梅隆大学开发的用于支持操作系统研究的操作系统内核。

BSD (Berkeley Software Distribution,伯克利软件套件)是Unix的衍生系统,在1977至1995年间由加州大学伯克利分校开发和发布的。

Core Services

Media

Cocoa Touch


Model=What your application is (but not how it is displayed)

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

View=Your Controller's minions


控制器可以直接和模型和视图对话

模型和视图不能对话

控制器设置自身为视图的委托

委托通过协议设置

视图通过协议获取控制器的数据

模型不能直接和控制器对话

The Model is UI independent


Properties

通常情况下OC我们不直接访问实例变量

The getter (usually) has the name of the property (e.g. "myValue:")

The setter's name is "set" plus capitalized property name (e.g. "setMyValue:")


strong,weak,nonatomic区别

strong:

keep the object that property points to in memory until I set this property to nil

weak:

if no one else has a strong pointer to this object, then you can throw it out of memory and set this property to nil.

nonatomic:

access to this property is not thread-safe. we will always specify this for object pointers in this course. If you do not, then the compiler will generate locking code that will complicate your code elsewhere.

BOOL的就不需要申明strong还是weak,因为primitive types are not strored in the heap.不是指针


@synthesize:表示creates the backing instance variable that is set and gotten.

- (NSString *)contents{
    return _contents;
}

- (void)setContents:(NSString *)contents{
    _contents = contents;
}



你可能感兴趣的:(斯坦福ios开发第一课:class logistics, overview of ios, MVC, Objective-C)