Re: KVC and arrays
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
References: | |
| >KVC and arrays (From: "Daniel Angermeier" <email@hidden>) |