基本没用过 Object-C
先来篇文档了解概念 http://www.cocoachina.com/b/?p=122
函数声明:
- (返回值类型) 函数名 : (类型)参数1 (类型)参数2
函数调用:
[self 函数名: 参数]
字符串前面要加 @
对象
声明 class
@infterface
@end
实现
@implementation
@end
简单解释
Java 的 GC 是 Runtime执行的
而 ARC 是 complile time 执行的
就是说编译的时候,自动插入/添加 the release, retain, autorelease 这些语句
GC 对于 ARC的好处
自动收集 retain cycles
赋值不不要额外的语句(比如转移 ownership)
ARC对于 GC 的好处
内存占用标尺小(对象释放快)
GC线程要吃 CPU资源,让app暂时,而ARC没有这种事
http://www.oschina.net/translate/objc-automatic-reference-counting-in-xcode-explained
http://en.wikipedia.org/wiki/Automatic_Reference_Counting
http://stackoverflow.com/questions/7874342/what-is-the-difference-between-objective-c-automatic-reference-counting-and-garb