如何在使用自动布局时设置纵横比填充图像。当我在 Storyboard 中设计时,它非常好,但是在设置图像时, ImageView 的高度非常高。我希望它是一个常量,我也为此添加了常量,但它不起作用。我正在使用最新的 Xcode。
最佳答案
来自 Apple Document,AspectFill
不保证剪辑内容。
The option to scale the content to fill the size of the view. Some portion of the content may be clipped to fill the view’s bounds.
所以你需要将clipToBounds
属性设置为True,或者在Storyboard中设置。
关于ios - 在纵横比中设置图像高度在 Xcode 中填充自动布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37613780/