Re: UIColor in CoreData database into NSColor
Re: UIColor in CoreData database into NSColor
- Subject: Re: UIColor in CoreData database into NSColor
- From: Quincey Morris <email@hidden>
- Date: Fri, 20 Feb 2015 21:48:24 +0000
On Feb 20, 2015, at 11:15 , Alex Kac <email@hidden> wrote:
>
> So with that in mind, has anyone tackled a conversion process of reading in UIColor data into NSColor via CoreData?
I suspect that *really* solving this is going to be impossible.
When you say “UIColor data”, do you mean the data resulting from archiving a UIColor object, or did you use something else to put it in the CoreData store? If it’s archived, you could try following the suggestion in the last response in this thread:
http://stackoverflow.com/questions/3292836/create-uicolor-from-nscolor-data <http://stackoverflow.com/questions/3292836/create-uicolor-from-nscolor-data>
That is to say, treat the raw data as a string, and then pick the components out of the string.
The trouble you’re going to have is that a UIColor may not always be represented as components, since some standard colors may have an arbitrary enum—is representation. You also have to deal with possible alternate representations that might have been saved by the iOS app running on older versions of iOS. Even if you have components, you really need to match colorspaces as well.
This makes me think you can get as far as getting NSColors that are at least similar to the UIColors, though sometimes they may not be exactly the same.
_______________________________________________
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