Use block-based enumeration when targeting 10.6+.

This commit is contained in:
Nate Weaver 2012-07-06 09:53:29 -05:00
parent 559e3fa755
commit 46d52d6549

View File

@ -12,15 +12,21 @@
- (NSArray *)selectedItems
{
NSMutableArray *items = [NSMutableArray array];
NSMutableArray *items = [NSMutableArray array];
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_3
NSIndexSet *indicies = [self selectedRowIndexes];
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
[indicies enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
[items addObject:[self itemAtRow:idx]];
}];
#else
unsigned int rowIndex = [indicies firstIndex];
while (rowIndex != NSNotFound)
{
[items addObject:[self itemAtRow:rowIndex]];
rowIndex = [indicies indexGreaterThanIndex:rowIndex];
}
#endif
#else
NSNumber *row;
NSEnumerator *enumerator = [self selectedRowEnumerator];