---
title: "imageForSegment(at:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uisegmentedcontrol/imageforsegment(at:)"
---

# imageForSegment(at:)

Returns the image for a specific segment.

## Declaration

```swift
func imageForSegment(at segment: Int) -> UIImage?
```

## Parameters

- `segment`: An index number identifying a segment in the control. It must be a number between 0 and the number of segments (doc://com.apple.uikit/documentation/UIKit/UISegmentedControl/numberOfSegments) minus 1; the segmented control pins values exceeding this upper range to the last segment.

## Return Value

Return Value Returns the image assigned to the receiver as content. If there is no image, it returns nil.

## See Also

### Managing segment content

- [setImage(_:forSegmentAt:)](uikit/uisegmentedcontrol/setimage(_:forsegmentat:).md)
- [setTitle(_:forSegmentAt:)](uikit/uisegmentedcontrol/settitle(_:forsegmentat:).md)
- [titleForSegment(at:)](uikit/uisegmentedcontrol/titleforsegment(at:).md)
