Re: Array Key-value Paths
Re: Array Key-value Paths
- Subject: Re: Array Key-value Paths
- From: Sheehan Olver <email@hidden>
- Date: Wed, 26 May 2004 13:26:14 -0500
'array' is a key in self. And not populated means empty but
instantiated (I guess I meant NSMutableArray). In any case, my
solution was to just create methods:
-(NSArray *)arrayAsDescription
-setArrayAsDescription:(NSArray *) d
and use the key "arrayAsDescription" instead. I guess the answer is
that
[self setValue:(NSArray *)a forKeyPath:@"array.description"]
calls
[ob setDescription:a]
for each ob in array. If array is empty, then it does nothing.
Thanks,
Sheehan Olver
On May 26, 2004, at 8:54 AM, Allan Odgaard wrote:
On 26. May 2004, at 5:50, Sheehan Olver wrote:
[...] what happens when you call:
[self setValue:descriptionArray
forKeyPath:@"array.description"]
It can't call "setDescription:" on anything because "array" is not
populated. I couldn't find a detailed description of key-value paths
in the documentation, unless I just looked in the wrong place.
From NSArray documentation:
- (void)setValue:(id)value forKey:(NSString *)key
Invokes setValue:forKey: on each of the receiver's
items using the specified value and key.
But I am not sure what you refer to above. Is 'array' a key in each
item in descriptionArray? And by "not populated" you mean empty?
Or doesn't it exist? Cause then you'll get a run-time exception.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.