• 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: Quality of icons in table view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quality of icons in table view


  • Subject: Re: Quality of icons in table view
  • From: Austin Sarner <email@hidden>
  • Date: Thu, 3 Nov 2005 13:23:42 -0500

Thanks for the reply. I went ahead and subclassed NSImageCell, forcing it to scale the image. It works, but it seems overly verbose for such a trivial issue -- I'm surprised there isn't a better way of handling this.

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
[[self image] lockFocus]; {
[[self image] setFlipped:YES];
[[self image] setScalesWhenResized:YES];
[[self image] setSize:(NSSize){16.0,16.0}];
} [[self image] unlockFocus];

[[self image] drawAtPoint:(NSPoint){cellFrame.origin.x -= ([[self image] size].width / 2.0 - cellFrame.size.width / 2.0),cellFrame.origin.y} fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
}


––––––––––––
Austin Sarner


On Nov 3, 2005, at 1:02 PM, Stephane Sudre wrote:


On 3 nov. 05, at 17:50, Austin Sarner wrote:

Hey,

I have a table view with a column I use to display some 16x16 icons based on paths. I use bindings and a value transformer to grab the image for the bound path, cache it, and return it -- displaying it in the image view. All works fine, the correct icon displays in the column -- but it looks horrible. It looks like it was scaled with no quality at all.

Now, the weird thing is that when I switch the content view of the window containing this table view back and forth (it's part of a preferences thing), the icon quality increases and looks just as good as the Finder's. Is there some magic refresh method that is being called when switching panes that I could call manually to have it look good initially? Any suggestions?

You may have to write some code to get the appropriate representation for the icon (basically the smallest one). From what I've seen with NSImageView / NSImageCell, you can't trust it to use the best representation by itself (example includes the Internet Explorer icon which was incorrectly rendered depending on weather conditions, OS version and weekly sports results).



_______________________________________________ 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: 
 >Quality of icons in table view (From: Austin Sarner <email@hidden>)
 >Re: Quality of icons in table view (From: Stephane Sudre <email@hidden>)

  • Prev by Date: Re: Quality of icons in table view
  • Next by Date: Re: Crash in _gatherFocusStateInto:upTo:withContext:?
  • Previous by thread: Re: Quality of icons in table view
  • Next by thread: Interface Builder, springy objects and TextField behaviour
  • Index(es):
    • Date
    • Thread