Ken Thomases wrote:

> How about a dictionary whose keys are NSValues representing the
> objects?  For each object, the value from the dictionary would be an
> NSMutableArray whose elements are the key paths being observed on that
> object.
> 
>     // ...
>     NSValue* objectKey = [NSValue valueWithNonretainedObject:object];
>     NSMutableArray* keyPaths = [observers objectForKey:objectKey];
>     if (!keyPaths)
>     {
>         keyPaths = [NSMutableArray array];
>         [observers setObject:keyPaths forKey:objectKey];
>     }
>     [keyPaths addObject:keyPath];

Hi Ken

Do you think that observing lots of objects with lots
of keypaths is a good idea anyway?

Maybe I'm considering my first approch again, using only key-value
coding inside the view and move the observing somewhere else ...

What I like about your idea is the use of

 [NSValue valueWithNonretainedObject:object];

I didn't know that. I'm quite new to coocoa, but not to programming.

Since the number of keypaths for each object is constant, I might
decide using a custom bitmap object as the value part in the
dictionary. That bitmap would indicate which keypath is being observed.

Thanks a lot.
Patrick


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to