O'Reilly logo

iOS App Development Portable Genius by Richard Wentk

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Custom Graphics

However you source your custom graphics, you have to add them to your app. Typically, you do this in Interface Builder. Views and controls include customization options that can load and display files you build with the app. The details vary, but the rest of this section includes some common techniques.

Adding a media file to your project

To use a file in a project, you must add it to the project manually. It’s efficient to keep graphics and other media in a single folder on disk and reference them as needed. It’s less efficient to copy media files into a project folder—although if you then make a backup copy of your project, media files will be included automatically and you won’t have to worry about restoring them separately.

The steps for adding media files to a project don’t depend on the media type. They’re identical for all media, including graphic images, video clips, sounds, and custom data.

For this example, start by creating a new project using the Single View Application template. Save it as UIExamples. (This is just a convenient name. There is no class called UIExamples.) Either create or source an image file with the basic iPhone resolution of 320 x 480. The contents of the file don’t matter.

After you have your file and a project to add it to, follow these steps:

1. Right-click the Supporting Files group in the Project navigator.

2. Select Add Files to… item from the menu.

3. Navigate to the file you’re about to import in the file sheet.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required