Binding table column to complex NSDictionary

  • I have a data structure that basically represents an XML file.  The
    top level is an NSDictionary and can have values which are
    NSDictionaries themselves and/or NSArrays.

    As an example I need to bind to a table column the results you would
    get from the following statement:
    [[myObject properties] valueForKeyPath:@"employees.name"]

    properties is an NSMutableDictionary; the key "employees" is an
    NSArray; each object in the NSArray is an NSDictionary which in this
    case has a key "name".

    The valueForKeyPath statement above returns an array of names as I
    expected but I would like to bind that (given myObject) to a table
    column within IB.
    I know I can set an ivar to the valueForKeyPath result but I was
    hoping to simply specify this in IB without code.
  • on 1/3/08 10:34 AM, <dbainbridge...> purportedly said:

    > [[myObject properties] valueForKeyPath:@"employees.name"]
    >
    > properties is an NSMutableDictionary; the key "employees" is an
    > NSArray; each object in the NSArray is an NSDictionary which in this
    > case has a key "name".
    >
    > The valueForKeyPath statement above returns an array of names as I
    > expected but I would like to bind that (given myObject) to a table
    > column within IB.

    You'll need the "employees" array as the content of an NSArrayController, to
    which you will bind your column value.

    Best,

    Keary Suska
    Esoteritech, Inc.
    "Demystifying technology for your home or business"
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today