Reputation: 3454
I have a NSMutableIndexSet of:
<NSMutableIndexSet: 0x85825c0>[number of indexes: 2 (in 2 ranges), indexes: (2 4)]
How do I set the number of indexes (2) to a property like an int and indexes to an array (2 4)
Upvotes: 0
Views: 1137
Reputation: 540145
You can use the count
method to get the number of indexes in the set.
With
enumerateIndexesUsingBlock:
you can enumerate all indexes in the set and add them
to an NSMutableArray
:
NSUInteger numberOfIndexes = [set count];
NSMutableArray *array = [NSMutableArray array];
[set enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
[array addObject:@(idx)];
}];
NSLog(@"%@", array);
Upvotes: 2