On 2009 May 01, at 14:59, iseecolors wrote:

I would like to have an image and a string together in my NSOutlineView, but it is not clear to me how to do this. Basically I want to do what iTunes appears to do (icons in front of the text descriptors).

My initial thought was to return and NSArray that contains and NSImage and NSString from the method:

- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item

Good guess. Try overriding -[NSTableColumn dataCellForRow] instead, and returning an instance of your own custom subclass of NSCell. This has been discussed more than once, as recently as within the last couple weeks in the list archives.

But apparently the returned id is just converted to an NSString. (if it only deals with strings, why support id?)

Because your table is using the default NSTextFieldCell. Different cells will support different types.

You should read the document "Control and Cell Programming Topics for Cocoa" at developer.apple.com.

_______________________________________________

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