• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: KVC and arrays
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KVC and arrays


  • Subject: Re: KVC and arrays
  • From: Brian Smith <email@hidden>
  • Date: Fri, 22 Jun 2007 10:15:23 -0600


On Jun 22, 2007, at 8:46 AM, Daniel Angermeier wrote:

I have an array controller that is bound to a property of someObject
that returns an array.
-(NSMutableArray *)items
{
    return myItems;
}

That array controller is bound to the table columns of a table view.

when I modify myItems, e.g. [myItmes removeLastObject];
the arrayController / the table view are not updated,
unless I call [self setItems:myItems]; after any modification to myItems.
Is this the correct way to do this, or is there something else I am
missing that would cause the bound objects to be updated if I modifiy
my mutable array ?

This is the expected behavior as the array controller is setup to observe someObject's items property, so it only observes changes in setting the array. To get it to observe changes in the array's objects you need to have someObject conform to the KVC indexed accessor pattern which is described in the "Key Value Coding Programming Guide".


Brian
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: KVC and arrays
      • From: mmalc Crawford <email@hidden>
References: 
 >KVC and arrays (From: "Daniel Angermeier" <email@hidden>)

  • Prev by Date: how do we play back keynote presentations in our apps?
  • Next by Date: Re: [OFF] NSDistributedNotification
  • Previous by thread: KVC and arrays
  • Next by thread: Re: KVC and arrays
  • Index(es):
    • Date
    • Thread