Working with Images

Working with images, Icons and Launch Screens in Xamarin.iOS.

PDF for offline use:
Sample Code:
Related Articles:

This section includes a variety of articles that cover working with images in a Xamarin.iOS application, such as using them as icons, launch screens or including them in controls and providing icons for custom document types

Overview

There are several ways that image assets are used inside an iOS application. From simply displaying an image as part of your application's UI to, assigning it to a UI control such as a UIButton or UIImageView, to providing icons and launch screens, Xamarin.iOS makes it easy to add great artwork to your iOS applications in the following ways:

  • Resolution Independent Images – Use iOS's built-in support for working with images across different device resolutions and types (iPhone, iPad, etc.).
  • Asset Catalog Image Sets - Use Asset Catalog Image Sets to manage and group all version of a given image asset required by an application.
  • Images in the iOS Designer - Use the iOS Designer to set images for controls.
  • Images in Code – Use the UIImage class's methods to load and work with image assets and assign them to UI controls in C# code.
  • Application Icon - Define the application icon required by every iOS application. This is the icon that the user will tap from the iOS home screen to launch the application. Additionally, this icon is used by Game Center, if applicable.
  • Spotlight Icon - Define the application's Spotlight icon. Whenever the user enters the name of your application in a Spotlight Search, this icon is displayed.
  • Settings Icon - Define the application's Settings icon. If the user enters the Settings app on their iOS device, this icon will be displayed at the end of the Settings list for your application.
  • Launch Screens - Define the application's Launch Screen. After the user taps the application icon and before the first view appears, a blank screen will be shown. Fortunately, iOS includes support for displaying an image of your choice (or a special type of Storyboard, which is preferred) in place of the blank screen.
  • iTunes Icon - Provide an iTune icon. If you are going to use the Ad-Hoc method of delivering your application (either for corporate users or for beta testing on real devices), you also need to include a 512x512 and a 1024x1024 image that will be used to represent your application in iTunes.
  • Document Icons - Use an image as an icon for any specific document type that a Xamarin.iOS application supports or creates.

Through a series of topics, this article shows how Xamarin.iOS takes full advantage of iOS to support image assets, all while handling the various device types and resolutions, and accomplish the tasks listed above.

Topics

There are several considerations that should be taken into account when creating image assets for an iOS application, as well as several places where those assets will be used. Each of these have an affect on not only how many image assets will be required, but how those assets are created. The following topics cover the types of images assets that will be required, how those assets are included in the application's bundle and how the image assets are consumed to provide the required functionality:

Image Sizes and Filenames

This article covers important information on the required images sizes and resolutions needed to support all current iOS devices and the file naming convention that can be used to supply the different version of each file.

Displaying an Image

This article covers including an image asset in a Xamarin.iOS application and displaying that image either by using C# code or by assigning it to a control in the iOS Designer.

Application Icons

This article covers including and managing an image asset in a Xamarin.iOS application to be used as an App Icon.

Launch Screens

This article covers including and managing an image asset in a Xamarin.iOS application to be used as a Launch Screen. It also covers using a special type of Storyboard to provide a universal Launch Screen for every iOS device size and resolution.

Custom Document Types

This article covers including and managing an image asset in a Xamarin.iOS application to be used as a Custom Document Type Icon.