How can I get my object index? I have a dictionary containing arrays and inside the arrays i have multiple dictionary.
My data structure(eg):
Student ------ NSDictionary
Item 0 ------ NSArray<br> Name ----- Grace<br> Age ----- 20<br> Item 1 ------ NSArray<br> Name ----- Anne<br> Age ----- 21<br>
So for example, I have the value of the name, Grace, and I want to get the value of the object index array (in this case, item 0). How can I do so?
I've used the indexOfObject however the results I got back is 2147483647, which i think it means nsnotfound. So i think it doesnt work for this case.
This are my codes:
NSMutableDictionary* namevalue = [[NSMutableDictionary alloc] init];
namevalue = [somedict objectForKey:@"Name"];
int arryindex;
arryindex = [somearray indexOfObject:namevalue];
NSLog(@"Array Index:%i", arryindex);
Can anyone help? Thank you so much!