GSI

'NSEnumerator'에 해당되는 글 1건

  1. 2009.07.25 [Objective-c NSArray] 사용법


## Style1
NSArray* array = [NSArray arrayWithObjects:object1, object2, object3 nil];
NSEnumerator* enumerator = [array objectEnumerator];
NSString* aString = @"son";
id anObject = [enumerator nextObject];
while (anObject != nil)
{
  [anObject doSomethingWithString:aString];
  anObject = [enumerator nextObject];
}

## Style2
NSArray* array = [NSArray arrayWithObjects:object1, object2, object3 nil];
NSEnumerator* enumerator = [array objectEnumerator];
NSString* aString = @"son";
id anObject = nil;
while ((anObject = [enumerator nextObject]))
{
  [anObject doSomethingWithString:aString];
}

##Style3
NSArray* array = ''';
for(id object in someContainer)
{
  ...
}
Posted by gsi
: