Guides and Sample Code

Developer

App Programming Guide for watchOS

On This Page

Images

watchOS provides the following ways to incorporate images into your content:

Specifying Your Image Assets

Here are guidelines to follow when creating your image assets:

  • Use the PNG format for images whenever possible.

  • Always create images that are sized appropriately for your interface. For images whose size you cannot control, use the setWidth: and setHeight: methods of the interface object to ensure that the image is displayed at the desired size.

  • Use image assets to manage your images. Image assets let you provide different versions of an image for each device size.

Using Named Images to Improve Performance

There are several ways to change the current image of an interface object:

Specifying images by name is more efficient because only the name string must be transferred to your Watch app. watchOS searches your Watch app bundle for an image file with the name you specified. The most efficient way to specify images efficiently is to store them in your Watch app bundle and use the setImageNamed: or setBackgroundImageNamed: as appropriate to configure the corresponding object.

Images created in your WatchKit extension must be transferred to the Watch app before they can be used. For example, using the imageNamed: method in your extension loads the image from your WatchKit extension’s bundle, not from your Watch app’s bundle. You can then call the setImage: method, passing in the image object. The WatchKit extension automatically transfers the image to the Watch app for display. While this has some additional overhead compared to loading images directly from the Watch app bundle, It should not have a significant impact on either performance or battery life.