I've been toying around with Cocoa, Bindings and Core Data, and I have three words to say:
ABSOLUTELY.FUCKING.AMAZING.
Wow. This technology is sorely missing from every other toolkit! It is amazing how much you can accomplish without any code! I'll try to re-implement my failed application in Cocoa, just for the hell of it.
Anyway, I found that in order to save image as data to a Core Data model, and be able to view it in an NSImageView, you have to do a little mucking around:
-
First, define the attribute in your entity as
Binary Data. Obvious. -
Drop an
NSImageViewsomewhere on your window. Make sure it is enabled. -
In the Bindings options, bind it to
data(notvalue!), and use theNSUnarchiveFromDatavalue transformer.
Done! Value transformers aren't heavily documented, but I got through. The problem was that Apple refers to NSUnarchiveFromDataTransformerName which is a constant that points to NSUnarchiveFromData, while Interface Builder uses the value.
Anyway, small peeve :)
This post is older than 30 days and comments have been turned off.
