Game Development Reference
In-Depth Information
A different background for each device
for this application.
Listing A-1. ViewController.m (viewDidLoad)
- (void)viewDidLoad
{
[super viewDidLoad];
UIImage* image = [UIImage imageNamed:@"background"];
[backgroundImageView setImage:image];
}
In Listing A-1, we see the
viewDidLoad
task of the class
ViewController
. We load a
UIImage
by
calling
imageNamed
and passing in just the base name. What is returned is the image appropriate for
the specific devices based on the filenames of the images included in the project. In this case, we
have the same filenames as those shown in Table
A-1
.
Now let's take a look at how we specify other support images based on device type, such as icons
and splash screens.