---
title: "setMaximumTrackImage(_:for:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uislider/setmaximumtrackimage(_:for:)"
---

# setMaximumTrackImage(_:for:)

Assigns a maximum track image to the specified control states.

## Declaration

```swift
func setMaximumTrackImage(_ image: UIImage?, for state: UIControl.State)
```

## Parameters

- `image`: The maximum track image to associate with the specified states.
- `state`: The control state with which to associate the image.

## Discussion

Discussion Because the movement of the slider’s thumb changes the width of the area occupied by the maximum track image, the image width must change accordingly. To accommodate this requirement, specify track images as stretchable images that can grow or shrink to fill the available space. For information about how to create stretchable images, see UIImage. When you specify a custom maximum track image, the slider ignores the custom maximum track tint color, if any. Sliders respond to user interaction with dynamic effects and appearance. If you use images to customize the appearance of the track, then the slider doesn’t apply the dynamic effects or alter the appearance. important: This method isn’t available when the user interface idiom is UIUserInterfaceIdiom.mac and behavioralStyle is UIBehavioralStyle.mac — calling it while in this state throws an exception.

## See Also

### Changing the slider’s appearance

- [minimumValueImage](uikit/uislider/minimumvalueimage.md)
- [maximumValueImage](uikit/uislider/maximumvalueimage.md)
- [minimumTrackTintColor](uikit/uislider/minimumtracktintcolor.md)
- [currentMinimumTrackImage](uikit/uislider/currentminimumtrackimage.md)
- [minimumTrackImage(for:)](uikit/uislider/minimumtrackimage(for:).md)
- [setMinimumTrackImage(_:for:)](uikit/uislider/setminimumtrackimage(_:for:).md)
- [maximumTrackTintColor](uikit/uislider/maximumtracktintcolor.md)
- [currentMaximumTrackImage](uikit/uislider/currentmaximumtrackimage.md)
- [maximumTrackImage(for:)](uikit/uislider/maximumtrackimage(for:).md)
- [thumbTintColor](uikit/uislider/thumbtintcolor.md)
- [currentThumbImage](uikit/uislider/currentthumbimage.md)
- [thumbImage(for:)](uikit/uislider/thumbimage(for:).md)
- [setThumbImage(_:for:)](uikit/uislider/setthumbimage(_:for:).md)
