Re: Subclassing NSCell (was Re: Problem With implementing copyWithZone)
Re: Subclassing NSCell (was Re: Problem With implementing copyWithZone)
- Subject: Re: Subclassing NSCell (was Re: Problem With implementing copyWithZone)
- From: Paul Robinson <email@hidden>
- Date: Mon, 8 Oct 2007 16:39:30 -0400
On 8-Oct-07, at 12:23 PM, Chris Hanson wrote:
On Oct 7, 2007, at 8:16 PM, Thaddeus Cooper wrote:
I am only implementing copyWithZone: because it is required for
the composite NSCell subclass that I am working on which combines
multiple pieces of data from an NSManagedObject subclass into a
single cell, so I believe that I want an absolute duplicate of
what is already in the store.
I also recently ran across the mysterious missing copyWithZone: when
trying to use a custom NSCell with NSManagedObjects.
I blogged about it at:
http://kupuk.com/2007/10/08/custom-nscells-with-nsmanagedobjects/
The short answer is that you need to override the setObjectValue:
method (which tries to copy your uncopyable NSManagedObject) in your
custom NSCell to convert your NSManagedObject into an NSValue (which
is copyable).
Paul
_______________________________________________
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