Re: Can't drag a custom data object.
Re: Can't drag a custom data object.
- Subject: Re: Can't drag a custom data object.
- From: Graham Cox <email@hidden>
- Date: Tue, 27 Apr 2010 17:15:58 +1000
On 27/04/2010, at 5:05 PM, Billy Flatman wrote:
> Hi Jens,
>
> Thanks for your help. I've been trying to get the option 1 approach to work, but I don't know what I'm meant to do with my NSValue. I can't find how to convert it to an NSData type.
NSData* data = [NSKeyedArchiver archivedDataWithRootObject:myValue];
>> (3) Implement a way to serialize the object into data or a dictionary/array. Implementing the NSCopying protocol is a standard way to do that.
I think perhaps Jens meant SCoding, not NSCopying. If you have an object that you want to be able to cut/paste or drag, adopt the NSCoding protocol and archive it directly (as above, but don't bother with a NSValue).
--Graham
_______________________________________________
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