Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Customize Icons

Mac OS X supports the display of very large icons for the desktop, the Dock, and in various other locations. The Finder uses a high-quality scaling algorithm to generate the variable-sized icons it needs. To help ensure a pleasing result, applications should provide at least a thumbnail icon (a large, 128 x 128 image) as part of an 'icns' resource (stored in an icon resource file with the extension “.icns”).

The Mail Search sample application provides customized icons in the file Mail Search.icns. Figure 11-7 shows this file as displayed by the Icon Composer application (which is located in /Developer/Applications/Utilities/).


Figure 11-7  Mail Search’s icons displayed in Icon Composer

Mail Search’s icons displayed in Icon Composer

To add custom icons to the Mail Search tutorial application requires the following steps:

  1. Create the icon art.

  2. Populate an icon resource file with the required icons (Figure 11-7 shows the contents of a fully-populated Icon Composer icon resource template).

  3. Add the icon resource file to the Mail Search application.

  4. Register a unique creator code for the application so that the Finder can display the correct icons for the application

The first two steps are not included here, but are described in other documentation. For example, Learning Cocoa by O’Reilly & Associates describes how to create a simple icon resource file with Icon Composer. For this tutorial, you can use the icon resource file provided by the Mail Search sample application.

Steps 3 and 4 are described in the following sections.

In this section:

Add an Icon Resource File to the Project
Supply a Creator Code


Add an Icon Resource File to the Project

To add an icon resource file to the Mail Search tutorial project, perform these steps:

  1. Open the Mail Search project in Xcode.

  2. The Mail Search sample project included with AppleScript Studio includes an icon resource file that contains customized icons. Open the folder for the Mail Search sample project and drag the file Mail Search.icns to the Files list in the Groups & Files list of the Mail Search project. You can insert it directly in the Resources group.

    You can also add this file to the Mail Search project by choosing Add Files from the Project menu in Xcode, as described in “Create a Project.” In either case, you’ll get the dialog shown in Figure 11-8.


    Figure 11-8  Adding a file to a project

    Adding a file to a project

    Select “Copy items into destination group’s folder (if needed),” then click Add to add the file to your project. If you used the Add Files menu choice, drag the file Mail Search.icns into the Resources group in the Groups & Files list.

  3. Double-click the Mail Search target in Xcode’s Targets group to open a window for the target. Use the disclosure triangles in the column view on the left to display Simple View within the Info.plist Entries section. Then click the Application Icon entry. The result is shown in Figure 11-9.


    Figure 11-9  The Icon field in a target window for the Mail Search target

    The Icon field in a target window for the Mail Search target
  4. Type the name of the file “Mail Search” into the Icon file text field. Note you do not add the .icns suffix.

  5. Build and run the Mail Search application. The new About window, now including the Mail Search icon, is shown in Figure 11-10.


    Figure 11-10  The About window after customizing icons

    The About window after customizing icons
  6. You may need to quit Xcode and restart the Finder to make sure the Finder recognizes the new icons.

Figure 11-11 shows the Mail Search icon in the Finder, at maximum resolution. Note the version string you added earlier shows up now in the Finder.


Figure 11-11  The Mail Search icon in the Finder

The Mail Search icon in the Finder

Supply a Creator Code

You should make sure your application has a unique creator code (or signature). The creator code identifies the application to the Finder so that it can display the correct icons for the application. If you create an AppleScript Studio application to distribute commercially, you should register your creator code with Apple Developer Technical Support, which keeps a database of creator codes to avoid conflict between applications.

Creator codes consisting entirely of lower case letters are reserved for Apple, so use at least one upper case letter in your code. You can make sure your creator code is unique (and also register it) at the following site:

http://developer.apple.com/datatype/

In Figure 11-9, the Applications Settings pane shows the application type (APPL, or application) and signature (????, the default value supplied by Xcode). If you look at the same pane for the Mail Search sample project, you will see that it has the creator code “wats”.

To add your unique, four-character creator code, type it in the Signature field on the Application Settings pane.



< Previous PageNext Page > Hide TOC


Last updated: 2006-04-04




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice