Re: NSArrayController KVO question...
Re: NSArrayController KVO question...
- Subject: Re: NSArrayController KVO question...
- From: Randy Widell <email@hidden>
- Date: Thu, 22 Nov 2012 10:57:31 -0800
Right, and in other places it works for me. For instance, I have a window with text fields bound to a model object through an object controller. Updating properties of the model updates the text fields.
Reading your test below, one thing I was forgetting is that I am not binding a column in the table view to any specific property. I have one column bound to arrangedObjects and a custom cell that draws all the information (think Apple Mail with the subject line and then a snippet below). So, I guess it does make sense that the table view does not update. Perhaps reloadData after I change the item.
The menu item's state property is bound to the archive property of selectedObjects. Seems like that should update appropriately. The only difference between that and your test is that I am not using an external array. I am just receiving the action from the menu item, then iterating over selectedObjects and changing the property on each.
On Nov 22, 2012, at 1:36, "email@hidden" <email@hidden> wrote:
> On 21 Nov 2012, at 22:19, Randy Widell <email@hidden> wrote:
>
>> Hmm. Well, I am updating the model (and the database that backs it). I just need the UI to reflect it.
> Hmm, that sounds wonky.
> The whole point of binding is that you can update your model and have your UI reflect the change without any other intervention.
> Is this occurring or not?
>
> Say you have a model M with properties P1 and P2.
>
> 1. Instantiate an array A of N model M objects.
> 2. Set the content of array controller AC to array A
> 3. Bind table view TV col1 to AC.arrangedObjects.P1 and col2 to AC.arrangedObjects.P2
>
> Now you should be able to update any model M property and see the changes reflected in the UI and vice versa.
>
> Regards
>
> Jonathan Mitchell
> Mugginsoft LLP
>
>
>
> _______________________________________________
>
> 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
_______________________________________________
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