My problem is quite simple. I have some data associated to a Key. The key and data are both NSString. So the first thing which comes to my mind is to use NSDictionary.
I usually access to the value like this: [myDict objectForKey:@"myKey"];
However, sometimes I need to access to the value by index.
sample: [myDict objectAtIndex: indexPath.row]
But of course, there is no index in a Dictionary.
There are many solutions to solve this problem, but I would like to know which one is the best.
What is the best way to access to a value thanks to its key or its index ?
Create your custom class say
DictionArrayhaving properties of arrays and dictionaries.Add properties
NSInteger index,NSString *valueetc and some methods to retrieve based on index and keys.