斯坦福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;
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值