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/).
To add custom icons to the Mail Search tutorial application requires the following steps:
Create the icon art.
Populate an icon resource file with the required icons (Figure 11-7 shows the contents of a fully-populated Icon Composer icon resource template).
Add the icon resource file to the Mail Search application.
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.
Add an Icon Resource File to the Project
Supply a Creator Code
To add an icon resource file to the Mail Search tutorial project, perform these steps:
Open the Mail Search project in Xcode.
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.
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.
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.
Type the name of the file “Mail Search” into the Icon file text field. Note you do not add the .icns suffix.
Build and run the Mail Search application. The new About window, now including the Mail Search icon, is shown in Figure 11-10.
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.
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.
Last updated: 2006-04-04