i have an array with dictionaries,
. how to get the index for a specific dictionary… [where I got the data for the dictionary i want to find, but need the index is on]
NSMutableDictionary *dictois = [[NSMutableDictionary alloc]init];
[dictois setObject:@"easySpritedd" forKey:@"Nombre"];
[dictois setObject:@"X" forKey:@"290"];
[dictois setObject:@"Y" forKey:@"300"];
int fooIndex = [self.bloquesArray indexOfObject: dictois];
but as you see i dont know yet how to get the dictionary for comparing in the indexOfObject
thanks!
NSDictionary objects have the following comparison methods:
With the following discussion
This should be the case for you. Sadly you cannot change the method which NSArray uses to calculate the indexOfObject: so it can’t help you, hence the solution provided by Denis is the best I can think of (unless you fancy subclassing NSArray which I wouldn’t recommend).
Just as a complement to Denis’ answer you could use the NSArray method
instead of
If having several equal objects in the array is a possibility.