Adding Icons to Applications

Mac OS X uses icons — little descriptive pictures — in many places to represent programs and their documents. Mac OS X also allows applications to change their icons while the applications are running. For example, the Mail program uses the icon containing an envelope to represent the application in the Dock and Finder. When Mail is active and you have unread mail messages, the Mail program adds an icon badge to its icon in the Dock to display how many messages are unread. As we’ve seen already, folders and documents also have icons.

Viewing Icons with the icns Browser Application

Application icons are typically stored in a file with a .icns extension. Each such file contains several images, of various sizes and bit depths, that are used by the Finder and other applications. A .icns file can also contain an icon mask that is used for transparency. Because bitmap images do not scale well, the .icns file format stores only icons that are 12 x 16, 16 x 16, 32 x 32, 48 x 48, or 128 x 128 pixels. You can simultaneously view all of the images for a given file with the icns Browser application, located in the /Developer/Applications folder.

The Mac OS X Mail application icons are stored in the file /Applications/ This file doesn’t normally appear in the Finder because the Finder hides system details from users. However, you can see the contents of the app.icns file by first choosing Finder’s Go Go to Folder command ...

Get Building Cocoa Applications: A Step by Step Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.