---
title: "setBackgroundImageData(_:)"
framework: watchkit
role: symbol
role_heading: Instance Method
path: "watchkit/wkinterfacebutton/setbackgroundimagedata(_:)"
---

# setBackgroundImageData(_:)

Sets the button’s background image to the image in the specified data object.

## Declaration

```swift
func setBackgroundImageData(_ imageData: Data?)
```

## Parameters

- `imageData`: A data object containing the image data in its native format. The image is displayed behind the button’s title text. Specifying nil removes the existing image. You may specify image data that contains multiple images running as an animation. The image is scaled as needed to fill the button’s content area.

## Discussion

Discussion Use this method when you already have image data in the raw PNG or JPG format. This method sends the data as-is, which lets you send the data in a compressed format. Sending compressed data is often more efficient than sending a UIImage object.

## See Also

### Setting the Button Background

- [setBackgroundColor(_:)](watchkit/wkinterfacebutton/setbackgroundcolor(_:).md)
- [setBackgroundImage(_:)](watchkit/wkinterfacebutton/setbackgroundimage(_:).md)
- [setBackgroundImageNamed(_:)](watchkit/wkinterfacebutton/setbackgroundimagenamed(_:).md)
