に含まれる最高の(数値の)インデックスのインデックスを取得するにはどうすればよいNSMutableIndexSet
ですか?
つまり、最高のNSUInteger(インデックス)がNSMutableIndexSet
?内にある位置です。
NSArray *results = [subCategory filteredArrayUsingPredicate:predicate];
if([results count] == 1) {
returns = [results objectAtIndex:0];
}
else if ([results count] > 1) {
NSMutableIndexSet *set = [NSMutableIndexSet indexSet];
for (NSString *subCat in results) {
NSUInteger indexs = 0;
for (NSString *comp in components) {
if ([subCat rangeOfString:comp].location != NSNotFound) {
indexs ++;
}
}
[set addIndex:indexs];
}
// find the position of the highest amount of matches in the index set
NSUInteger highestIndex = ...;
returns = [results objectAtIndex:highestIndex];
}