On Dec 15, 2008, at 5:11 AM, rajesh wrote:

I have a table column(With ImageCell) to be filled with images , I have a NSTreeController

Is this a column in an outline view or a table? NSTreeController is intended for an outline view or browser.

which has dictionary for this image ( dictionary has few details , using which I fetch the images ) after binding this column with the said dictionary and running the build , in run log , I see complaints, that it is expecting an NSImage .... and hence image don't show up

Well, of course. How would you expect an NSImageCell to know how to draw itself given your dictionary?


previewID has dictionary with it. every other column is fine with the binding , except this imageColumn

Well, I don't know what kind of cells you're using in the other columns, but I would expect that they would have to be bound to a specific key within the dictionary, not the dictionary itself. If you bind to the dictionary itself, a text field (for example) will show the contents of the dictionary as given by the -description method. That "works" after a fashion, but is probably not what you really intend.


You could implement a custom value transformer to transform your dictionary into an image. However, that seems strange to me. That puts the logic for figuring out the image for one of model elements into the view. It seems to me that such logic belongs in the model.

Why don't you add a property to your model objects (whatever it is which has the PreviewID property currently) which gives the desired image? If you're worried about performance considerations, that property need not be backed by storage -- it can consist of only a getter method which dynamically determines the image to use and returns that. It might use some smart caching technique.

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to