FROM : Paul Szego
DATE : Sun Apr 03 00:59:52 2005
Hi,
I'm writing a custom NSView to provide a graphical representation of
some data that's in an NSArray. I've written indexed accessors in my
document class, and can hook up an NSArrayController no problem.
If I wanted to use bindings to hookup my view, either through a
controller or directly onto the document class (yes - I know that's not
necessarily good, but it's not the point of this post), how much do I
need to implement myself?
My first naive guess was that if everything was KVC and KVO compliant,
I could issue issue the bind: call and the default implementation in
NSObject would be fine. And this does seem to work - in a limited
fashion - for simple properties (i.e. an object, scalar or to-one
association). It doesn't seem to work for to-many properties.
After a lot of searching around I found statements to the effect that
"there's nothing magic about bindings - the binding name is not simply
the name of a KVC compliant property". It also seems the bindings made
available in the app kit classes such as views and controllers have a
lot of additional functionality that's been hand crafted - it's not all
just magic from the default NSObject's default implementation.
So what, if anything, can I expect to get "for free" from the default
implementations? Do I need to implement it all myself?
Thanks, Paul.
DATE : Sun Apr 03 00:59:52 2005
Hi,
I'm writing a custom NSView to provide a graphical representation of
some data that's in an NSArray. I've written indexed accessors in my
document class, and can hook up an NSArrayController no problem.
If I wanted to use bindings to hookup my view, either through a
controller or directly onto the document class (yes - I know that's not
necessarily good, but it's not the point of this post), how much do I
need to implement myself?
My first naive guess was that if everything was KVC and KVO compliant,
I could issue issue the bind: call and the default implementation in
NSObject would be fine. And this does seem to work - in a limited
fashion - for simple properties (i.e. an object, scalar or to-one
association). It doesn't seem to work for to-many properties.
After a lot of searching around I found statements to the effect that
"there's nothing magic about bindings - the binding name is not simply
the name of a KVC compliant property". It also seems the bindings made
available in the app kit classes such as views and controllers have a
lot of additional functionality that's been hand crafted - it's not all
just magic from the default NSObject's default implementation.
So what, if anything, can I expect to get "for free" from the default
implementations? Do I need to implement it all myself?
Thanks, Paul.
| Related mails | Author | Date |
|---|---|---|
| Paul Szego | Apr 3, 00:59 | |
| Scott Stevenson | Apr 4, 04:46 |






Cocoa mail archive

