• 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: NSImage in NSTableView looks like poop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage in NSTableView looks like poop


  • Subject: Re: NSImage in NSTableView looks like poop
  • From: David Adamson <email@hidden>
  • Date: Wed, 15 Aug 2001 10:46:11 -0400

On Wednesday, August 15, 2001, at 04:05 AM, sam goldman wrote:

I have a file browsing application in the works and it grabs the icon
for display in a table view. My problem (as you might have guessed from
the subject) is that the icon looks like crap. The current size is 30x30
and the image sizes proportionally. I think that the problem might be as
simple as changing that size, but I don't know what size to change it
to. It may be more complex than this as well, so whatever information
you can give will be appreciated. I am a newbie that's getting to be
pretty intermediate.

I'm mucking about with something similar right now, and have found that icon-dimensions in multiples of 16 look a lot less poopy, and most especially the 'standard' sizes of small (16), large (32), huge (64), and utterly ridiculous, much bigger than any nail on any thumb I've ever seen, (128). I'm not sure how big the row-gutter on the tableView is, so you may need to aim a few pixels higher. How the Finder keeps its icons so silky smooth at any size eludes me.

What I did, not a very wonderful way, was, in the drawing method of the IconAndTextCell from the DragNDropOutlineView example, to cause the icon to resize to the nearest 16-multiple of the cell-frame's height, and it looks pretty good. The relevant code:

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
if (image != nil)
{
int dimension = 16 * (int)(cellFrame.size.height / 16);
NSSize imageSize = NSMakeSize(dimension, dimension);
NSRect imageFrame;

[image setSize:imageSize];

//unchanged from the example from here on
...
}
[super drawWithFrame:cellFrame inView:controlView];
}


But I'd like to do it better, if anyone has any thoughts.

Good luck, and may all the Cocoa file browsers of the world one day rise up against their Carbon progenitor and oppressor, that the Finder may become Lost amidst its stronger children,
-David.


  • Follow-Ups:
    • Re: NSImage in NSTableView looks like poop
      • From: Finlay Dobbie <email@hidden>
    • Re: NSImage in NSTableView looks like poop
      • From: Tom Waters <email@hidden>
  • Prev by Date: Re: [OT] default web browser
  • Next by Date: Re: Threads, safeness, and AutoreleasePools
  • Previous by thread: NSImage in NSTableView looks like poop
  • Next by thread: Re: NSImage in NSTableView looks like poop
  • Index(es):
    • Date
    • Thread