Note that there are some explanatory texts on larger screens.

plurals
  1. POUITableView (not using Navigation Template) getting specific data from plist
    primarykey
    data
    text
    <p>I'm using the example on page 210 of Beginning iPhone Development (Exploring the iPhone SDK) book and it's similar to what I want to do but that specific example is complicated by using sections in the TableView. I have a specific hierarchy in my plist...</p> <pre><code>Root ---- Dictionary Rows ---- Array Item 0- Dictionary fullName ---- String address ---- String Item 1 ---- Dictionary fullName ---- String address ---- String </code></pre> <p>So I have a UITableView that takes up a small portion of the view on that "screen" The rest of the view has other elements so I chose nut to use a navigation template.</p> <p>The code I'm using doesn't match up because I'm really not clear on calling which fields.</p> <p>Can someone show me a VERY simple example how I could list all the "firstNames" in that table. If something is wrong with my plist please let me know specifically what to change.</p> <p>In a nutshell I want to loop through all the Item # dictionaries to list all the first names. My design is similar to a contact list, but not exactly a contact list.</p> <p>Right now I'm using this code which simply displays the word "Rows" I changed the word rows to Rows1 in my plist and that shows up so it's grabbing that "array item". I hope I said that right.</p> <pre><code>-(void)viewDidLoad { NSString *path = [[NSBundle mainBundle] pathForResource:@"data" ofType:@"plist"]; NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:path]; self.names = dict; [dict release]; NSArray *array = [[names allKeys] sortedArrayUsingSelector:@selector(compare:)]; self.listData = array; [super viewDidLoad]; } </code></pre> <p>&nbsp;</p> <pre><code>-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.listData count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *SimpleTableIdentifier = @"Identifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleTableIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier] autorelease]; } NSUInteger row = [indexPath row]; cell.textLabel.text = [listData objectAtIndex:row]; return cell; } </code></pre> <p>I've scoured the web for days trying to find a simple example that uses a plist hierarchy to list items in a table that is not part of a navigation template.</p> <p>Thanks So Much</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload