달력

10

« 2024/10 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
2010. 5. 19. 21:48

[10일차-2]Dictionary Objective-C2010. 5. 19. 21:48

Dictionary
  • Key와 Value로 구성되는 컬렉션
  • Key 값으로 Value를 빠르게 검색합니다.
  • Key와 연결된 Value는 nil 일 수 없습니다.
  • Key는 유일해야하며 일반적으로 NSString 입니다.

1. NSDictionary
+(id)dictionary
+(id)dictionaryWithObject:(id)anObject forKey:(id)aKey
-(id)initWithObjects:(NSArry *)Objects forKeys:(NSArray *)Keys
-(id)initWithObjects:(id *)Objects forKeys:(id*)Keys count:(NSUInteger)count
-(id)initWithObjectsAndKeys:(id)Object,(id)Key,... nil
-(NUInteger)count
-(id)objectForKey:(id)aKey
-(NSArray*)allKeys
-(NSArray*)allValues
-(NSEnumerator *)keyEnumerator
-(NSEnumerator *)objectEnumerator
-(NSArray *)allKeysForObject:(id)anObject

배열을 데이터롤 사용하는 dictionary와 dictionary를 배열로 저장
ex)


2. NSMutableDictionary

  • 삽입과 삭제가 가능한 Dictionary

+(id)DictionaryWithCapacity:size
-(id)initWithCapacity:size
-(void)setObject:(id)anObject forKey:(id)aKey
-(void)removeAllObjects
-(void)removeObjectForKey:key
-(NSArray*)keysSortedByValueUsingSelector:@selector(비교메서드:)

:
Posted by 에너지발전소