Binding (KVC/KVO) for C struct datatypes
Binding (KVC/KVO) for C struct datatypes
- Subject: Binding (KVC/KVO) for C struct datatypes
- From: "Rudolph van der Merwe" <email@hidden>
- Date: Thu, 4 Oct 2007 15:12:22 +0200
I'm trying to create the following programatic binding:
[view bind:@"frame.size.width" toObject:self withKeyPath:@"width" options:nil];
Both view and width are instance variables in my controller object declared as:
NSImageView * view;
float width;
In other words, I'm trying to bind the frame width of the NSImageView
to a float ivar in my object.
This doesn't seem to work: I get the following runtime error:
An uncaught exception was raised
[<NSConcreteValue 0x145a60> valueForUndefinedKey:]: this class is not
key value coding-compliant for the key size.
*** Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[<NSConcreteValue 0x145a60> valueForUndefinedKey:]: this
class is not key value coding-compliant for the key size.'
It seems the problem here is that [view frame] returns a NSRect
C-struct which has a size field which itself is a NSSize C-struct,
which has a float field 'width'. I was hoping that KVC can parse [view
frame].size.width using the @"frame.size.width" key-path. This doesn't
seem to be the case.
How does one implement bindings (or general KVC/KVO) for C-structs ?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden