I am trying to figure out how to create a set of indexes of lets say (1, 2, 3) then use it in
- (void)selectRowIndexes:(NSIndexSet *)indexes byExtendingSelection:(BOOL)extend
It's the (NSIndexSet *)indexes
I do not know how to use / create / populate with indexes 1, 2, 3. Should I use a class method or instance method?
I tried a whole bunch of ways but I have no idea what I'm doing ...
If the indexes are consecutive like in your example, you can use this:
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(1, 3)];
If not, create a mutable index set and add the indexes (or ranges) one by one:
NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet]; [indexSet addIndex:3]; [indexSet addIndex:5]; [indexSet addIndex:8];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With