Re: Struct Property Key Path
Re: Struct Property Key Path
- Subject: Re: Struct Property Key Path
- From: Kiel Gillard <email@hidden>
- Date: Wed, 15 Apr 2009 15:04:25 +1000
Hi Richard,
You can't bind to the individual members of your struct.
You could create a pair of accessor methods for the object containing
the struct. These methods could return the values of the struct. For
example:
@interface MyManagedObject : NSManagedObject {
NSPoint origin;
}
- (CGFloat)originX;
- (CGFloat)originY;
@end
@implementation MyManagedObject
- (CGFloat)originX
{
return origin.x;
}
- (CGFloat)originY
{
return origin.y;
}
@end
You would then implement two + (NSSet
*)keyPathsForValuesAffectingOrigin[X | Y] and return the keypath to
your struct ivar.
Hope this helps,
Kiel
On 15/04/2009, at 2:49 PM, Richard Somers wrote:
I have a model object which is a subclass of NSManagedObject. This
object has a transformable property similar to NSPoint.
The frameworks automatically wrap and unwrap my NSPoint like struct
in an NSValue instance. I would like to bind the individual struct
members x and y to elements of the user interface with a key path. I
can not seem to figure out how to get this work or if it is even
possible.
Any suggestions?
Richard
_______________________________________________
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
_______________________________________________
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