Re: NSTableView who retains NSTableColumns?
Re: NSTableView who retains NSTableColumns?
- Subject: Re: NSTableView who retains NSTableColumns?
- From: Matt Neuburg <email@hidden>
- Date: Thu, 19 Oct 2006 10:06:31 -0700
- Thread-topic: NSTableView who retains NSTableColumns?
On Thu, 19 Oct 2006 16:58:04 +0200, Ole Voss <email@hidden> said:
>
>The past two days I've been trying to manually fill an NSTableView with
>columns containing NSImageCells.
>Needless to say I haven't succeeded ;-)
>
>What I do so far is that I create an empty NSTableView in IB and then
>try to fill it in my Controller by allocating and initing NSCells and
>adding them to allocated and inited NSTableColumns.
Wait - that doesn't make sense. If you're creating the NSTableView in IB,
can you explain why you don't also set the cell types of the columns as
NSImageCell right there? That's what the little picture of a mountain in the
Cocoa-Data widget pane is for. Just drag it onto a column in the table.
Poof, it's an image-cell column.
However, if you really want to create image-cell columns from scratch,
here's the code:
NSTableColumn* tc = [[[NSTableColumn alloc]
initWithIdentifier:@"fileIconColumn"] autorelease];
[tc setDataCell: [[[NSImageCell alloc] initImageCell: nil] autorelease]];
[theTable addTableColumn:tc];
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden