Re: Bindings and Custom Array Operators
Re: Bindings and Custom Array Operators
- Subject: Re: Bindings and Custom Array Operators
- From: Steven Kramer <email@hidden>
- Date: Wed, 16 Mar 2005 09:29:52 +0100
Op 16-mrt-05 om 6:09 heeft E. Wing het volgende geschreven:
Hello, I would like to something kind of like the example at
http://homepage.mac.com/mmalc/CocoaExamples/ManualBindings.zip,
where there is a table of values and some field is computed based upon
all the values in the table.
However, in my case, I need to do some computations that are more
complex and are not expressed by the existing array operators provided
by Cocoa.
I was wondering if it is possible to define my own array operators.
Looking around, I don't see any hints of that, so in the case that it
is not possible, how would you recommend I approach this problem?
I would like to retain the live updating nature of the example, where
changing a value in the table can instantly recompute and redisplay
the value.
It can be done only in part and in an unsupported way. For instance, by
defining a category on NSArray with a method '- (id) myOperator', you
can use '@myOperator' for the keypath. You can't use 'deeper' keypaths,
like '@myOperator.length' to have myOperator work on the 'length'
properties of your items in the array. Not without overriding KVC
methods, that is.
Regards,
Steven Kramer
--
email@hidden
http://sprintteam.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