---
title: "setImageScaling(_:forSegment:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nssegmentedcontrol/setimagescaling(_:forsegment:)"
---

# setImageScaling(_:forSegment:)

Sets the scaling mode used to display the specified segment’s image.

## Declaration

```swift
func setImageScaling(_ scaling: NSImageScaling, forSegment segment: Int)
```

## Parameters

- `scaling`: One of the image scaling constants. For a list of possible values, see doc://com.apple.appkit/documentation/AppKit/NSImageScaling.
- `segment`: The index of the segment whose enabled state you want to get. This method raises an exception (doc://com.apple.documentation/documentation/Foundation/NSExceptionName/rangeException) if the index is out of bounds.

## See Also

### Configuring a segment image

- [setImage(_:forSegment:)](appkit/nssegmentedcontrol/setimage(_:forsegment:).md)
- [image(forSegment:)](appkit/nssegmentedcontrol/image(forsegment:).md)
- [imageScaling(forSegment:)](appkit/nssegmentedcontrol/imagescaling(forsegment:).md)
