首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 企业软件 > 行业软件 >

主要的知识点整理

2012-11-29 
重要的知识点整理1:id是隐式指针,所以不需要*2:Dynamically-typed object:e.g:id anObjStatically-typed

重要的知识点整理

1:id是隐式指针,所以不需要*

2:

Dynamically-typed object:e.g:id anObj;

Statically-typed object:e.g:Person *anObj;

?

3:OC 提供编译时类型检查,而不是运行时类型检查,所有的类型检查都发生在编译时

4:OC总是使用动态类型绑定

?

5:OC创建对象只能通过动态创建的方式!

?

6:nil :it's basically always just zero typed to it as an id !

?

7:Collections summary:

?

Array:? ordered collection of objects

Note:? NSNotFound returned for index if not found

//在数组中,这样来判断一个元素是否存在:if([array indexOfObject:@".."]==NSNotFound){//not exists};

Dictionary: collection of key-value pair

Note :nil returned for key if not found

Set: unordered? collection of unique objects

?

common :

1:common enumeration mechanism

2:Immutable and mutable version :

??? Immutable collectionscan be shared without side effect //无副作用

??? Prevent unexpected changes

??? Mutable ojects typically carry a performance overhead //性能开销

?

8:数组中只能存储非基础类型数据

)NSInteger是基础类型,但是NSNumber是一个类。如果想要在NSMutableArray里存储一个数值,直接用NSInteger是不行的,比如在一个NSMutableArray里面

?

9:CGFloat 与 float 之间的区别

相信在定义数据类型的时候可能会有类似的疑惑,CGFloat和float到底有什么区别,什么时候该用哪一种?


CGFloat is just a typedef for either?float?or?double.
typedef?float?CGFloat;// 32-bittypedef?double?CGFloat;// 64-bit
对于需要兼容64位机器的程序而言,需要用CGFloat,当然从长远角度考虑还是推荐尽量使用CGFloat。尽管在32位上相比float增加了一些memory footprint的消耗。
short //一般情况下是short int的简写,表示短整形,其长度一般情况下只有int长度的一半

热点排行