How do I set up toolbar button images with system-applied gradients in OS X Lion?
Apple’s human interface guidelines recommend using use plain PDF files for images within toolbar controls, because Lion applies gradients and other effects to these files. Apple HIG: Designing Toolbar Icons
But for some reason, when I use a PDF file for a toolbar button image, no effects are applied.
I don’t think the problem is the PDF file, because if I change the name of the PDF file to something used by other applications on my computer (for example, Apple Mail or Panic’s Transmit), effects are applied.
Does anyone know the correct way to make Lion apply effects to images in toolbar buttons (that is, the way to do it without changing the name of the image file to something already used by another application)? There has to be a step somewhere that I missed.
The frameworks usually only apply effects to icon images if they are marked as templates.
Apart from using the
setTemplate:method ofNSImage, you can also rename your images. This is from the documentation ofimageNamed:…