ios - Getting Dictionary Keys for the Filtered Values -


i having nsmutabledictionary (subjectvalue) contains value , keys. want filter based on values searched in search bar. so, used code below.

nsarray *allvalues = [subjectvalue allvalues]; nsarray *filteredvalues = [allvalues filteredarrayusingpredicate:predicate]; 

now, filteredvalues have values based on search word.

now, want keys filtered values got above result. know how values , all, want keys filtered result.

please advise how can that?

this not duplicate of question. existing query link

what has been asked in above link is, how retrieve values based on predicate search. i'm asking beyond that. have got filtered values, want keys filtered values. question different.

there function keysofentriespassingtest in nsdictionary. looking for? example:

nsdictionary *subjectvalue = @{@"1":@"a", @"2":@"b", @"3":@"c", @"4":@"d"}; nsarray *filteredvalues = @[@"b", @"d"];   nsset *keys = [subjectvalue keysofentriespassingtest:^bool(id key, id obj, bool *stop) {     return [filteredvalues containsobject:obj]; }]; nslog(@"%@", keys.description); 

the output {(4,2)} (nsset)


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -