I have multiple NSImageView
of different dimensions and proportions that are stacked vertically in a view that has limited horizontal space.
Since the image dimensions can be larger than the size of the parent view I want to scale them down proportionally by using NSImageScaleProportionallyDown
.
The problem for me seems to be the default behaviour of NSImageViews
where it only scales down the axis that exceeds the constraints set by auto layout and then centers the NSImage
in the NSImageView
, this causes the NSImageView
to take up as much height as if it was not scaled down at all and breaks the vertical flow since the space between the images vary.
I have tried to set [questionImage setContentHuggingPriority:NSLayoutPriorityRequired forOrientation:NSLayoutConstraintOrientationHorizontal];
without any success.
So how do you make the NSImageView only take up as much space as the proportionally scaled NSImage requires?