---
title: "setDividerImage(_:forLeftSegmentState:rightSegmentState:barMetrics:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uisegmentedcontrol/setdividerimage(_:forleftsegmentstate:rightsegmentstate:barmetrics:)"
---

# setDividerImage(_:forLeftSegmentState:rightSegmentState:barMetrics:)

Sets the divider image to use for a given combination of left and right segment states and bar metrics.

## Declaration

```swift
func setDividerImage(_ dividerImage: UIImage?, forLeftSegmentState leftState: UIControl.State, rightSegmentState rightState: UIControl.State, barMetrics: UIBarMetrics)
```

## Parameters

- `dividerImage`: The divider image to use.
- `leftState`: The state of the left segment.
- `rightState`: The state of the right segment.
- `barMetrics`: Bar metrics.

## Discussion

Discussion To customize the segmented control appearance, provide divider images for the following cases: Between two unselected segments, where leftState and rightState are both normal Between a selected segment on the left and an unselected on the right, where leftState is selected and rightState is normal Between an unselected segment on the left and a selected on the right, where leftState is normal and rightState is selected

## See Also

### Customizing appearance

- [selectedSegmentTintColor](uikit/uisegmentedcontrol/selectedsegmenttintcolor.md)
- [backgroundImage(for:barMetrics:)](uikit/uisegmentedcontrol/backgroundimage(for:barmetrics:).md)
- [setBackgroundImage(_:for:barMetrics:)](uikit/uisegmentedcontrol/setbackgroundimage(_:for:barmetrics:).md)
- [contentPositionAdjustment(forSegmentType:barMetrics:)](uikit/uisegmentedcontrol/contentpositionadjustment(forsegmenttype:barmetrics:).md)
- [setContentPositionAdjustment(_:forSegmentType:barMetrics:)](uikit/uisegmentedcontrol/setcontentpositionadjustment(_:forsegmenttype:barmetrics:).md)
- [UISegmentedControl.Segment](uikit/uisegmentedcontrol/segment.md)
- [dividerImage(forLeftSegmentState:rightSegmentState:barMetrics:)](uikit/uisegmentedcontrol/dividerimage(forleftsegmentstate:rightsegmentstate:barmetrics:).md)
- [titleTextAttributes(for:)](uikit/uisegmentedcontrol/titletextattributes(for:).md)
- [setTitleTextAttributes(_:for:)](uikit/uisegmentedcontrol/settitletextattributes(_:for:).md)
