Home / iPad

Adding an Application Icon

You shouldn't procrastinate about adding an application icon. A welldesigned icon adds a professional touch, and it takes time to get it right. You may start out with a "placeholder" icon until you've had a chance to explore the App Store and look at other icons, but whether or not you have a finished icon, it helps you identify the app in the Simulator (in case you've installed other projects), and psychologically, it boosts your confidence that the app is real.

An application icon is simply a 57-x-57-pixel .png graphics file. Add the file in the same way you added the image in the "Adding an Image to the View" section, earlier in this tutorial. Follow these steps:

  1. In Xcode, drag the graphics file into the Resources folder in the Project window's Groups & Files list.
    An alternative is to click the Resources folder in Xcode, choose Project → Add to Project, and then navigate to the file you want to add. After dragging or adding the file, Xcode displays a dialog for making a copy of the file.
  2. Select the Copy Items into Destination Group's Folder check box to copy the file, and then click Add to finish copying the graphics file into your project.
    You don't need to change the default settings for Reference Type, Text Encoding, or Recursively Create Groups for Any Added Folders.

After you add the icon's graphics file, you also need to specify that this file is what you want used as the application's icon. You do that by using one of those other mysterious files you see in the Resources folder: DeepThoughts-Info.plist. The "plist" part is your clue: The file is a property list. Property lists are used extensively by applications as a uniform and convenient means of organizing, storing, and accessing data such as the filename for the app's icon. Xcode lets you edit property lists directly so that you can create and change them as you need to. Here's how:

  1. In the Resources folder, click the DeepThoughts-Info.plist file.
    The contents of the info.plist file are displayed in the Editor pane. You're treated to some information about the application, including an item in the Key column labeled Icon file.
  2. Double-click in the empty space in the Value column next to the Icon file.
  3. Type the name of your .png graphics file and then build the project as you normally would.
    You know - click the Build and Run button in the Project Window toolbar, choose Build → Build and Go (Run) from the main menu. Building the project gives you the opportunity to save it. (You could also quit Xcode, which also gives you the opportunity to save the project.)

After building and running the project, you see your new app icon for the app rather than a blank icon in the Simulator. Now your project looks serious! Which means it's now time to add some serious code that does something interesting with the view.

[Previous] [Contents]