Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I have an image view that i would like to maintain the aspect ratio of but still be able to resize the window.
在界面生成器中将图像视图缩放属性设置为“按比例向上或向下”,并设置包含它的窗口的内容纵横比:
[window setContentAspectRatio:myImageView.image.size];
据我所知,没有办法“自动”执行此操作,您需要跟随窗口的框架更改(使用委托方法 windowWillResize:toSize:) 并调整您的图像视图的框架,但是您希望它改变.