Navigate plists?

Discussion in 'iPhone/iPad Programming' started by Danneman101, Jul 23, 2010.

  1. macrumors 6502

    Joined:
    Aug 14, 2008
    #1
    Im having a little trouble navigating a plist in a tableview.

    MENU.plist
    Code:
    Root (Array)
    
    -> Item 0 (String) (LEVEL 1)
    
    --> Item 0 (String) (LEVEL 1.1)
    --> Item 0 (String) (LEVEL 1.2)
    --> Item 0 (String) (LEVEL 1.3)
    
    -> Item 0 (String) (LEVEL 2)
    
    --> Item 0 (String) (LEVEL 2.1)
    --> Item 0 (String) (LEVEL 2.2)
    --> Item 0 (String) (LEVEL 2.3)
    
    -> Item 0 (String) (LEVEL 3)
    
    --> Item 0 (String) (LEVEL 3.1)
    --> Item 0 (String) (LEVEL 3.2)
    --> Item 0 (String) (LEVEL 3.3)
    
    I know how to populate the tableview with the values: [LEVEL 1, LEVEL 2, LEVEL 3] using the following code:


    myViewController.m
    Code:
    - (void)viewDidLoad {
    	NSBundel *bundle = [NSBundle mainBundle];
    	NSString *path = [bundle pathForResource:@"MENU" ofType:@"plist"];	
    	var_CurrentPlist = [[NSArray alloc] initWithContentsOfFile:path];
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    	NSArray *temp = [var_CurrentPlist objectAtIndex:indexPath.row];
    	cell.textLabel.text = [temp objectAtIndex:0];
    }
    
    But how do I dig a little deeper into the xml of the plist and populate the same tableview with, for instance, the values [LEVEL 2.1, LEVEL 2.2, LEVEL 2.3]?
     

Share This Page