Can you explain what exactly you are trying to accomplish with this? As in, how would you interact with the structure? Do you look stuff up in it? If so, how do you do the lookup? Child ID? Child Name? Category Name? Some combination of these?
__________________ Recall It!Tag your notes. Tag your photos. Tag your thoughts. Tag your life.
i have a tableView with sections. for the title of the section it will be the name of the main category.in this case (cars). and the rows belong to this section will be filled with the names of the child categories.
and regarding how to retrieve it maybe something like this
OK. I was about to suggest a dictionary where category name maps to a sub dictionary which would contain your child id/names.
However, I'm glad I didn't. A dictionary is not an appropriate data source for a table view. Perhaps an array of category names, and then a dictionary mapping category name to a sub array of child names (do you actually need the child ID for anything?).
But even better would be a database. Unless your needs and the size of your data set are both very light.
How much data will you be handling, and where will you get it from? And how often will it change? Finally, what will you actually be doing with this table view? Displaying your data, sure, but for what ultimate purpose?
__________________ Recall It!Tag your notes. Tag your photos. Tag your thoughts. Tag your life.
OK. I was about to suggest a dictionary where category name maps to a sub dictionary which would contain your child id/names.
this is exactly what i was looking for.
if you can please change the previous code or guide me on how to do exactly that.
and yes i really need the child ID with the name.so i can send it to the remote server which will save it in the user preferences and also to do other operations based on it.
this is exactly what i was looking for.
if you can please change the previous code or guide me on how to do exactly that.
and yes i really need the child ID with the name.so i can send it to the remote server which will save it in the user preferences and also to do other operations based on it.
thank you.
No, I can't... please re-read my previous post on why I don't recommend using a dictionary, after hearing what you are going to do with it.
You shouldn't use an unordered collection (such as a dictionary) as the data source for a table view.
__________________ Recall It!Tag your notes. Tag your photos. Tag your thoughts. Tag your life.
No, I can't... please re-read my previous post on why I don't recommend using a dictionary, after hearing what you are going to do with it.
You shouldn't use an unordered collection (such as a dictionary) as the data source for a table view.
well, it seems i can't find the best way to do it. child names and ids are needed so i can't use your second suggestion. and using db is not practical also.
well, it seems i can't find the best way to do it. child names and ids are needed so i can't use your second suggestion. and using db is not practical also.
regards
You could easily create a class to hold your data, and then put instances of the class into an array.
__________________ Recall It!Tag your notes. Tag your photos. Tag your thoughts. Tag your life.