• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
More : NSTableView who retains NSTableColumns?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

More : NSTableView who retains NSTableColumns?


  • Subject: More : NSTableView who retains NSTableColumns?
  • From: Ole Voss <email@hidden>
  • Date: Thu, 19 Oct 2006 20:22:25 +0200


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.


I'm sorry everybody. I was jumping ahead because I've been busy with this and my head just got cluttered.


I know about the IB and using NSImageCells from the palette - that I've done lots of times and it works fine for tables where I know before how many columns I want displayed. Unfortunately this time I have to react dynamically and add and remove columns as I import data. So I'm stuck with having to manage this from scratch... Sorry for being so confused.

@Matt: Thanks for the example. That is actually what I've been doing, but I didn't autorelease the Cells/Columns. Instead I retained them myself because I wasn't sure if a TableView keeps tabs on them itself. Somehow this is not working though... I'm going to check on my code again - and will add the autorelease instead of hogging memory ;-)



Regards,

Ole.
_______________________________________________
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


References: 
 >Re: NSTableView who retains NSTableColumns? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Is NSNotification from NSStepper possible
  • Next by Date: Re: Is NSNotification from NSStepper possible
  • Previous by thread: Re: NSTableView who retains NSTableColumns?
  • Next by thread: Force app to be key
  • Index(es):
    • Date
    • Thread