Hi,
I would like to organize data in categories but can't figure out how to do this. I want it to be like in a database when you have a 1:N relation
In my app I have an array with objects and another array with the categories.
Lets take a very simple example:
If I have the class Fruit like this:
NSString *name;
NSString *country;
NSString *sort;
The objects could be:
fruit1 -> name:aName1 country:india sort:apple
fruit2 -> name:aName2 country:sweden sort
ear
fruit3 -> name:aName3 country:UK sort:banana
fruit4 -> name:aName4 country:China sort:apple
fruit5 -> name:aName5 country:USA sort
ear
fruit6 -> name:aName6 country:Mexico sort:banana
all fruits are saved into the array fruits
the categories are:
apple
banana
pear
So, I want to examine something like this:
Any ideas on how to organize the data?
Thanks in advance!
MACloop
I would like to organize data in categories but can't figure out how to do this. I want it to be like in a database when you have a 1:N relation
In my app I have an array with objects and another array with the categories.
Lets take a very simple example:
If I have the class Fruit like this:
NSString *name;
NSString *country;
NSString *sort;
The objects could be:
fruit1 -> name:aName1 country:india sort:apple
fruit2 -> name:aName2 country:sweden sort
fruit3 -> name:aName3 country:UK sort:banana
fruit4 -> name:aName4 country:China sort:apple
fruit5 -> name:aName5 country:USA sort
fruit6 -> name:aName6 country:Mexico sort:banana
all fruits are saved into the array fruits
the categories are:
apple
banana
pear
So, I want to examine something like this:
Code:
for(Fruit *f in fruits) {
if f.sort is one of the categories...
here I want to organize the fruits somehow... as sublevels in the categories array?
}
Any ideas on how to organize the data?
Thanks in advance!
MACloop