• 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
Re: ImageInTableview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ImageInTableview


  • Subject: Re: ImageInTableview
  • From: Seth Willits <email@hidden>
  • Date: Sun, 10 Aug 2003 13:33:23 -0700

On Sunday, August 10, 2003, at 01:06 PM, Mathew Peterson wrote:

I want to place a small image in a tableview row for a certain column when its called. This is the code I am using but its simply sending me a description of the image (sure, the image is there...just not in the right form).

How can I make the image display correctly?

The key parts are [tableColumn setDataCell:] and returning an image from tableView:objectValueForTableColumn:


-(void)awakeFromNib
{
NSImageCell * imgCell;

imageArray = [NSArray arrayWithObjects:
[NSImage imageNamed:@"1"],
[NSImage imageNamed:@"2"],
[NSImage imageNamed:@"3"],
[NSImage imageNamed:@"4"],
nil];
[imageArray retain];

imgCell = [[NSImageCell alloc] initImageCell:nil];
[[tableView tableColumnWithIdentifier:@"Thumbnails"]
setDataCell:imgCell];

[tableView setDataSource:self];
}


-(int)numberOfRowsInTableView:(NSTableView *)tableView
{
return 4;
}

-(id)tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *)tableColumn
row:(int)row
{
return [imageArray objectAtIndex:row];
}




Seth Willits
------------------------------------------------------------------------ ---
President and Head Developer of Freak Software - http://www.freaksw.com
Q&A Columnist for REALbasic Developer Magazine - http://www.rbdeveloper.com
Webmaster for REALbasic Game Central - http://www.freaksw.com/rbgames

"Often, by taking a chance, you either lose it or gain from it. If you have
nothing to lose, why hesitate? Not pursuing the things you want in
life only lets the opportunity to obtain them pass you by."
-- Seth Willits
------------------------------------------------------------------------ ---
_______________________________________________
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.
References: 
 >ImageInTableview (From: Mathew Peterson <email@hidden>)

  • Prev by Date: Re: Question regarding menus and document based app.
  • Next by Date: Looking for clarification on Applescript event handlers
  • Previous by thread: ImageInTableview
  • Next by thread: Re: ImageInTableview
  • Index(es):
    • Date
    • Thread