0

I'm a newbie programmer in Mac software developing and now there is a problem I cannot solve it. I want to make a Mac software with simple functions. It looks like the following screenshots, this software has only one window, and the window can be resized by the user. The window is composed of a stackview, and there are several imageviews in the stackview, like a clock. When I wrote ios apps, I made the width of the stackview equal with 0.5 of the superview(in the storyboard). No matter how big the size of the picture is, it can be perfectly displayed and restricted.

However, in cocoa to write Mac app, if the stackview and window are constrained, the stackview(made by the imageviews) will stretch out the whole window, the window can be very huge . I hope that the size of the stackview can be scaled according to the size of the window automaticly, how can I solve it, thank you!

  • Have you tried adjusting the Hugging and Compression Resistance Priorities? Post a [mre] please. – Willeke Aug 02 '23 at 09:40
  • Does this answer your question? [How to resize an NSImageView in an NSStackView?](https://stackoverflow.com/questions/75167362/how-to-resize-an-nsimageview-in-an-nsstackview) – Willeke Aug 03 '23 at 10:08
  • thanks a lot Willeke ! it is really works ,I solved this problem with changing the imageview‘s Content Compression Resistance Priority – BROWN TOM Aug 03 '23 at 15:34

0 Answers0