<!--
{
  "availability" : [
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSegmentedCell/setImageScaling(_:forSegment:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSSegmentedCell(im)setImageScaling:forSegment:"
  },
  "title" : "setImageScaling(_:forSegment:)"
}
-->

# setImageScaling(_:forSegment:)

Sets the image scaling mode for the specified segment.

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

## Parameters

`scaling`

The scaling mode to assign to the specified segment. For the possible values, see [`NSSegmentedControl.Style`](/documentation/AppKit/NSSegmentedControl/Style).

`segment`

The index of the segment whose image scaling mode you want to set. This method raises an exception (<doc://com.apple.documentation/documentation/Foundation/NSExceptionName/rangeException>) if the index is out of bounds.

## Discussion

The image scaling mode for a segment affects how the image inside the corresponding cell is positioned and resized when the cell itself grows or shrinks. The image scaling mode does not itself cause the cell to change size in any way. If a cell does not contain an image, the scaling mode has no effect.

---

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)