NSArrays and NSArrayControllers

  • I have a container view which contains a number of inner views.  These
    inner views represent an
    equal number of model objects in an array which is bound to my
    container view through an NSArrayController.
    I'm a little new to this, so I was wondering if there was an efficient
    way for a new inner view to be created
    when an object is added to the array, and of course for one to be
    delete when an object is removed from
    the array.  To my understanding, the only message I will get is that
    the array *changed*, and I will thus be forced
    to completely re-set up my views every time the array changes.  Is
    this correct?  Or is there some sort of
    - (void)controllerDidAddObjects:toIndexes: ?  Or perhaps I'm
    completely thinking about this in the wrong way.

    Thanks!

    Francisco Tolmasky
    <tolmasky...>
  • On Jan 11, 2008, at 11:51 AM, Francisco Tolmasky wrote:

    > I have a container view which contains a number of inner views.
    > These inner views represent an
    > equal number of model objects in an array which is bound to my
    > container view through an NSArrayController.
    > I'm a little new to this, so I was wondering if there was an
    > efficient way for a new inner view to be created
    > when an object is added to the array, and of course for one to be
    > delete when an object is removed from
    > the array.  To my understanding, the only message I will get is that
    > the array *changed*, and I will thus be forced
    > to completely re-set up my views every time the array changes.  Is
    > this correct?  Or is there some sort of
    > - (void)controllerDidAddObjects:toIndexes: ?  Or perhaps I'm
    > completely thinking about this in the wrong way.
    >
    You can always ask the object to which you're bound how many things
    you have -- see Graphics Bindings.
    See also NSCollectionView.

    mmalc
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