0

I have UITableView that will have several child UITableViews which may also have 1 or 2 childs each.

I want to create a plist to keep track and structure all the cell names and stuff.

Man view -> Child -> Child -> Child -> Detail

What is the best way to structure this? Array or Dictionary?

1 Answers1

3

You will probably want an array of dictionaries, where each array represents a row and the dictionary contains info about the cell, and potentially the child table views. Consider modeling this off the settings bundle plist format.

jtbandes
  • 115,675
  • 35
  • 233
  • 266
  • So maybe root will be an array of dictionaries (one for each cell in root TableView). Then each dictionary will have string "cell name" and another dictionary for its child view, etc? –  Aug 09 '11 at 22:35
  • Can you check out my plist so far and see if I'm doing it right? Also, based on my structure, how can I load the necessary data into an array to load the relevant tableviews? http://www.box.net/shared/static/dmrrj2hd7jqgonnqlq60.plist –  Aug 09 '11 at 23:08
  • It's really up to you. What you have so far looks workable. To load it you can use `+arrayWithContentsOfFile:` or the `NSPropertyListSerialization` class. – jtbandes Aug 09 '11 at 23:15
  • Thanks! So for the initial tableview, I use this code: `NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"ICD9Disease" ofType:@"plist"]; NSArray *contentArray = [NSArray arrayWithContentsOfFile:plistPath];` But how can I make it so in didSelecectRowAtIndex, it knows to load the next table with the values for that particular dictionary? –  Aug 10 '11 at 00:20
  • You would just use the selected index to figure out what the next table is. – jtbandes Aug 10 '11 at 00:43
  • Yeah I know that, but how do I specifiy what data to load into that table. Ill only have 1 subTable view file which can load different data from the plist depending on what cell the user clicked in the parent view. –  Aug 10 '11 at 01:09