<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UISegmentedControl/setDividerImage(_:forLeftSegmentState:rightSegmentState:barMetrics:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UISegmentedControl(im)setDividerImage:forLeftSegmentState:rightSegmentState:barMetrics:"
  },
  "title" : "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.

```
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

To customize the segmented control appearance, provide divider images for the following cases:

- Between two unselected segments, where `leftState` and `rightState` are both [`normal`](/documentation/UIKit/UIControl/State-swift.struct/normal)
- Between a selected segment on the left and an unselected on the right, where `leftState` is [`selected`](/documentation/UIKit/UIControl/State-swift.struct/selected) and `rightState` is [`normal`](/documentation/UIKit/UIControl/State-swift.struct/normal)
- Between an unselected segment on the left and a selected on the right, where `leftState` is [`normal`](/documentation/UIKit/UIControl/State-swift.struct/normal) and `rightState` is [`selected`](/documentation/UIKit/UIControl/State-swift.struct/selected)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)