NSArrayController bindings -- duplicate data?

  • I have an set of unit types in my app which are managed by a fairly
    simple controller.  I also have a master-detail interface in my
    preferences  for changing the display name of units (for instance
    gal. instead of gallon).  I'm using an NSArrayController to fill this
    interface and it is bound to my unit controller's set (data key path
    is "unitController.units" bound to my app delegate).  The problem is
    that it seems the Array Controller is copying the set, so when I try
    to read a value elsewhere in my app after I have changed it in the
    preferences I get the old data.  Any ideas what I might be doing wrong?

    ->Ben
  • Figured it out.  -awakeFromNib gets called on the owner object of a
    nib when it is loaded, so when I loaded the Nib which contained the
    ArrayController, my app delegate's awakeFromNib was getting called
    (it was set to the file's owner of the loaded nib).  I was loading my
    units array from file there and so I'd blow away the original array
    with the data from disk, breaking the binding.

    ->Ben

    On Oct 6, 2006, at 2:25 PM, Ben Lachman wrote:

    > I have an set of unit types in my app which are managed by a fairly
    > simple controller.  I also have a master-detail interface in my
    > preferences  for changing the display name of units (for instance
    > gal. instead of gallon).  I'm using an NSArrayController to fill
    > this interface and it is bound to my unit controller's set (data
    > key path is "unitController.units" bound to my app delegate).  The
    > problem is that it seems the Array Controller is copying the set,
    > so when I try to read a value elsewhere in my app after I have
    > changed it in the preferences I get the old data.  Any ideas what I
    > might be doing wrong?
    >
    > ->Ben
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/<blachman...>
    >
    > This email sent to <blachman...>
previous month october 2006 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