KVC Problems with Indexed Accessor for To-Many Properties
KVC Problems with Indexed Accessor for To-Many Properties
- Subject: KVC Problems with Indexed Accessor for To-Many Properties
- From: joe OneNinetyTwo <email@hidden>
- Date: Fri, 13 Oct 2006 08:10:46 -0700 (PDT)
I'm having problems implementing KVC with indexed
accessor for a To-Many property. Here are some
details...
(1) I have a core data model
(2) I have an entity called DataSet, which contains a
binary attribute called data. I want to support Key
Value coding for a "fake array"
in DataSet called dataPoints, which are
NSMutableDictionary objects that will be extracted out
of the data (NSData) according to the index.
(3) Inside DataSet I have implemented...
(a) - (unsigned int) countOfDataPoints
(b) - (NSMutableDictionary *)
objectInDataPointsAtIndex:(unsigned int)index
(c) - (void) insertObject:(NSMutableDictionary *)
dataPoint inDataPointsAtIndex:(unsigned int)index
(d) - (void) removeObjectFromDataPointsAtIndex:
(unsigned int)index
(4) Inside MyDocument.nib I have an NSArrayController
(a) set to Class Mode with Object Class Name of
NSMutableDictionary
(b) managedObjectContext bound to the File's Owner
(c) contentArray bound to the selection.dataPoints of
another NSArrayController whose content is DataSet
objects.
(d) and an NSTableView with columns bound to the
NSArrayController with a keypaths of
arrangedObjects.key1, arrangedObjects.key2, ... for
each key inside the NSMutableDictionary.
(5) I have Insert and Remove buttons connected to
-insertDatum and -removeDatum methods in my code,
which call ...
- (void) insertObject:(NSMutableDictionary *)
dataPoint inDataPointsAtIndex:(unsigned int)index
- (void) removeObjectFromDataPointsAtIndex: (unsigned
int) index
and this works fine: I can populate and remove rows
from the tableview.
My problem is: When I edit a value (cell) in the
table, once I hit return the cell goes back to it's
original value. I thought that my arrayController
would call removeObjectFromDataPointsAtIndex followed
by insertObject:inDataPointsAtIndex in this case, but
they never get called by the array controller. What
am I missing here? I can see that countOfDataPoints
and objectInDataPointsAtIndex are being called by the
arrayController, but not the others.
Since dataPoints is a "fake" array, I can't put a -
(NSArray *) dataPoints and - (void) setDataPoints
method in my DataSet class.
Thanks for advance, if you can give any advice.
Philip
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden