1 / 46
文档名称:

[斯坦福大学iOS开发教程2010年秋].Lecture.4.pdf

格式:pdf   页数:46
下载后只包含 1 个 PDF 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

[斯坦福大学iOS开发教程2010年秋].Lecture.4.pdf

上传人:kuo08091 2013/12/18 文件大小:0 KB

下载得到文件列表

[斯坦福大学iOS开发教程2010年秋].Lecture.4.pdf

文档介绍

文档介绍:Stanford CS193p
Developing Applications for iPhone 4, iPod Touch, & iPad
Fall 2010
Stanford
CS193p
Fall 2010
To d a y
More Foundation Framework
NSArray, NSDictionary, NSSet
Enumeration
Property Lists
User Defaults
More Objective-C
Allocating and Initializing objects
Memory Management
Demo
NSDictionary / Enumeration
NSNumber
Introspection
Stanford
CS193p
Fall 2010
Foundation Framework
NSArray
Ordered collection of objects.
Immutable. That’s right, you cannot add or remove objects to it once it’s created.
Important methods:
- (int)count;
- (id)objectAtIndex:(int)index;
- (void)makeObjectsPerformSelector:(SEL)aSelector;
- (NSArray *)sortedArrayUsingSelector:(SEL)aSelector;
- (id)lastObject; // r e t u r n s nil if there are no objects in the array (convenient)
NSMutableArray
Mutable version of NSArray.
- (void)addObject:(id)anObject;
- (void)insertObject:(id)anObject atIndex:(int)index;
- (void)removeObjectAtIndex:(int)index;
Stanford
CS193p
Fall 2010
Foundation Framework
NSDictionary
Hash table. Look up objects using a key to get a value.
Immutable. That’s right, you cannot add or remove objects to it once it’s created.
Keys are objects which must implement - (NSUInteger)hash & - (BOOL)isEqual:(NSObject *)obj
Keys are usually NSString objects.
Important methods:
- (int)count;
- (id)objectForKey:(id)key;
- (NSArray *)allKeys;
- (NSArray *)allValues;
NSMutableDictionary
Mutable version of NSDictionary.
- (void)setObject:(id)anObject forKey:(id)key;
- (void)removeObjectForKey:(id)key;
Stanford
- (void)addEntriesFromDictionary:(NSDictionary *)otherDictionary; CS193p
Fall 2010
Foundation Framework
NSSet
Unordered collection of objects.
Immutable. That’s right, you cannot add or remove objects to it once it’s created.
Important methods:
- (int)count;
- (BOOL)containsObject:(id)anObject;
- (id)anyObject;
- (void)makeObjectsPerformSelector:(SEL)aSelector;
- (id)member:(id)anObject; // u s e s