Re: Some crash.
Re: Some crash.
- Subject: Re: Some crash.
- From: Sandro Noel <email@hidden>
- Date: Sun, 03 Aug 2008 00:15:14 -0400
Chris.
Thank you for the explaination!!
but it leaves me with a question, where should i use it.
I'm actually adding objects to the array, using addObject message, in
the model,
where should i use the mutableArrayValueForKey, and what keyPath
should I use.
the workflow is quite simple, the user selects a file, the controller
calls my model to load the file in various classes,
and one of the property of the model is transactions which is a
MutableArray,
that array is bound to the array controller, which is in turn
providing the tableview with data.
I'm new to cocoa... sorry bout that.
thank you for your help.
On 2-Aug-08, at 8:08 PM, Chris Hanson wrote:
On Aug 2, 2008, at 2:07 PM, Sandro Noel wrote:
when the Array is filled on application init, the data displays
fine, but if I add to the array "programatically"
the new data is not displayed, i've tried:
[self didChangeValueForKey:@"transactions"];
and [transactionTableView reloadData];
If you're using bindings, you can't just manipulate an
NSMutableArray instance variable directly and expect it to post KVO
notifications. And don't try to "cheat" and put KVO notifications
around all of the various manipulation of your mutable array,
either; you'll clutter your code and wind up with subtle bugs if you
forget one or use the wrong one in the wrong case.
Instead, just use -mutableArrayValueForKey: to get a proxy to the
property and manipulate that. It will post KVO notifications and
also manipulate the instance variable that you have backing the
property. If you need to intercept the modifications to your
property, you can override the mutable-array KVC methods described
in <Foundation/NSKeyValueCoding.h> or in the Key-Value Coding Guide.
-- Chris
_______________________________________________
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