Re: Images in NSOutlineViews and NSTableViews
Re: Images in NSOutlineViews and NSTableViews
- Subject: Re: Images in NSOutlineViews and NSTableViews
- From: mw <email@hidden>
- Date: Mon, 04 Nov 2002 19:45:13 -0500
Ahhhhh, okay, thanks very much! I figured it might look something like that,
but I like to overcomplicate things sometimes, so I just wanted to be sure
;-).
Thanks to Stiphane for your help too!
mw
On 11/4/02 11:11 AM, "matt neuburg" <email@hidden> wrote:
>
On Mon, 4 Nov 2002 09:00:18 -0500 (EST), "mw"
>
<email@hidden> said:
>
>
> I would just like to know how to place an image in an NSOutlineView or
>
> an NSTableView
>
> I have looked through the archives, and all of the answers there have
>
> just said to use NSImageCells instead of the default NSTextCell in one
>
> of the columns. But, I have no idea how to change the type of cell for
>
> a column in a table view
>
>
It couldn't be simpler. For example:
>
>
[[myTable tableColumnWithIdentifier: @"imageCol"]
>
setDataCell: [[[NSImageCell alloc] init] autorelease]];
>
>
Just do that once and you're done. Now the Really Cool Part (c) is that the
>
objectValue for an image cell is its image, so in your data source's
>
implementation of tableView:objectValueForTableColumn:row: you just return the
>
desired NSImage for that row. m
>
>
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt
>
pantes anthropoi tou eidenai oregontai phusei
>
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
"Stiphane Sudre" wrote:
>
In your awakeFromNib code
>
>
NSImageCell * myImageCell;
>
>
myImageCell=[NSImageCell new];
>
>
myColumn=[myTableView tableColumnWithIdentifier:@"My Column Name"];
>
>
[myColumn setDataCell: myImageCell];
>
>
It's the same code for NSOutlineView that does have Columns.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.