读书时间2011/06/25 - 1 iPhone/iPad相关

本文深入探讨了Objective-C中的内存管理、setter方法、属性、类别、协议等内容,并详细介绍了CocoaTouch中的核心框架、文件I/O、NSLog、Bundle、网络编程和UIKit控件等关键知识点。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

Apple's iPhone Online Videos

 

Introduction to Objective-[C and Cocoa Touch

 

0. 杂想杂问:

 

Milestone升级为Android 2.2,可支持Hot Spot功能!

http://bbs.spforum.net/viewthread.php?tid=324923

 

*** Objective-C ***

 

1. Memory Mangement

为什么要用retain/release?

原因是从系统得到的对象,有可能被放入了autorelease pool,若不retain,则可能被released!

 

example:

myString = [[NSString alloc] initWithString:@"foo"];

myString = [NSString stringWithString:@"foo"];

 

区别:后者被autoreleased,所以,一定要retain/release.

 

2. Setter method

-(void)setName:(NSString*)newName {

    if(newName!=name) {

        [newName retain];

        [name release];

        name = newName;

    }

}

 

3. Property

 

* Attribute

Mutability: readonly/readwrite

Memory Mangement behaviour: assign/retain/copy

Concurrency: nonatomic

 

4. category

5. procotol

 

*** Cocoa Touch ***

 

1. core founcation classes

* NSString

* NSArray

* NSMutableDictionary

 

2. File I/O

*special directories

tmp: cleared, not backed up

library/Cache: saved, not backed up ???

everything else: backed up ???

 

3. NSLog

4. Bundles

a special kind of folder

. executable

. UI file

. Metadata

. resources

 

5. Networking

CFMetwork,

CFSocket

POSIX

 

6. UIKit

Controls

 

Web View

 

7. Design Patterns

 

* MVC 

Model: Foundation

View: UI Kit

Controller: UIKit

 

* Target-action

Control:

    Target: object

    Action: Selector

 

* Notifications

Observed object -> Notification Center -> Controller/Observer

 

* Delegation

Application Delegate: when app lunched ???

Customization without subclassing ???

 

* Summary of all patterns

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值