populated tableview with from array/dictionary

Discussion in 'Mac Programming' started by donaghy, Aug 24, 2009.

  1. donaghy macrumors member

    Joined:
    Aug 6, 2009
    #1
    Hi all,

    I have an NSMutableArray which contains a MSMutableDictionary (this contains info like Name, Type, etc for each record). I'm tryin to make this array the datasource of a table view. However when i run the app it showing '{' in the table column. This is the method i use to return value into table row:

    Code:
    - (id) tableView: (NSTableView *) tv 
    objectValueForTableColumn: (NSTableColumn *) tableColumn 
    			 row: (int) row 
    { 
        NSString *v = [arrayDevices objectAtIndex:row]; 
        return v; 
    } 
    When i 'po' in the console screen the value 'v' its showing this:
    {
    name = "00 A1";
    }

    Can anyone tell me how i can return only the value of the object key name?

    help appreciated, cheers.
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    Can you post the code where you add objects to arrayDevices?
     
  3. donaghy thread starter macrumors member

    Joined:
    Aug 6, 2009
    #3
    This is where i add objects to arrayDevices:

    - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
    {
    //NSLog(@"ended element: %@", elementName);
    if ([elementName isEqualToString:mad:"Table"])
    {
    [item setObject:currentName forKey:mad:"name"];
    [arrayDevices addObject:[item copy]];
    }
    }
     
  4. ChOas macrumors regular

    Joined:
    Nov 24, 2006
    Location:
    The Netherlands
    #4
    My guess is that you mean this:

    Code:
    NSString *v = [[arrayDevices objectAtIndex:row] objectForKey:@"name"];
    
     
  5. donaghy thread starter macrumors member

    Joined:
    Aug 6, 2009

Share This Page