0

I have this fragment of code in my app

imvPallet.frame = NSRect(x: 5, y: 5, width: 200, height: 150)
imvPallet.imageScaling = .scaleAxesIndependently
self.view.addSubview(imvPallet)
imvPallet.image = NSImage(named: "Pallet")

where imvPallet is NSImageView object and Pallet is PNG image with original size 779 × 518 pixels stored in app's Assets. Image is still displayed in fixed original size regardless of imvPallet.frame dimension and various scaling parameters. My aim is to always fit image to imvPallet.frame size. Thanks for hints.

Dawy
  • 770
  • 6
  • 23

1 Answers1

-1

Try to scaleProportionallyUpOrDown for fit image to imvPallet

imvPallet.imageScaling = .scaleProportionallyUpOrDown
zezuuu
  • 19
  • 4