'STUDY > Objective-C' 카테고리의 다른 글
objective c // calcurate (0) | 2010.06.30 |
---|---|
[Objective C] NSDictionary , NSMutableDictionary (0) | 2010.06.24 |
[Objective C] method 앞에 plus (+) , minus (-) (0) | 2010.06.24 |
[Objective C] NSArray , NSMutableArray, Enumeration (0) | 2010.06.24 |
[Objective C] NSMutableString (0) | 2010.06.24 |
[Objective C] NSString (0) | 2010.06.24 |
NSDictionary
- Dictionary
- 키워드와 그 정의의 모음
- 주어진 key (보통 NSString 객체)에 대한 값 (임의의객체)을 저장
- 많은 데이터에 저장할 경우 NSArray를 사용해서 순차검색 하는 것 보다 수백 배 더 빠를수 있음
+(id) dictionaryWithObjectsAndKeys: (id)firstObject, …;
-(id) objectForKey: (id) akey;
Tire *t1 = [Tire new]; Tire *tire = [tires objectForKey: @”back-right”];
Tire *t2 = [Tire new];
Tire *t3 = [Tire new];
Tire *t4 = [Tire new];
NSDictionary*tires;
tires = [NSDictionarydictionaryWithObjectsAndKeys:
t1 @”front-left” t2 “front-right”
t3, @”back-left”, t4, @”back-rignt”, nil];
NSMutableDictionary
+(id) dictionaryWithCapacity: (unsigned int) numItens;
-(void) setObject: (id) anObject forKey: (id) aKey;
-(void) removeObjectForKey: (id) aKey;
NSMutableDictionary*tires;tires = [NSMutableDictionarydictionary];// 혹은 +(id) dictionaryWithCapacity: (unsigned int)numItems[tires setObject: t1 forKey: @”front-left”];[tires setObject: t2 forKey:@”front-right”];[tires setObject: t3 forKey: @”back-left”];[tires setObject: t4 forKey: @”back-right”];…[tires removeObjectForKey: @”back_left”];
'STUDY > Objective-C' 카테고리의 다른 글
objective c // calcurate (0) | 2010.06.30 |
---|---|
[Objective C] NSDictionary , NSMutableDictionary (0) | 2010.06.24 |
[Objective C] method 앞에 plus (+) , minus (-) (0) | 2010.06.24 |
[Objective C] NSArray , NSMutableArray, Enumeration (0) | 2010.06.24 |
[Objective C] NSMutableString (0) | 2010.06.24 |
[Objective C] NSString (0) | 2010.06.24 |
' + ' - class method
' - ' - instance method
c.f) http://en.wikipedia.org/wiki/Objective-C
'STUDY > Objective-C' 카테고리의 다른 글
objective c // calcurate (0) | 2010.06.30 |
---|---|
[Objective C] NSDictionary , NSMutableDictionary (0) | 2010.06.24 |
[Objective C] method 앞에 plus (+) , minus (-) (0) | 2010.06.24 |
[Objective C] NSArray , NSMutableArray, Enumeration (0) | 2010.06.24 |
[Objective C] NSMutableString (0) | 2010.06.24 |
[Objective C] NSString (0) | 2010.06.24 |