[英]How to resize an image view to fit the image and scale appropriately for an iPhone swift
我有一个UIImageView和一个UILabel。
我在情节提要中为边界添加了前导和尾随约束。
我正在从图像数组中设置图像,每个图像的大小各不相同。
图像在纵横比上适合于图像视图,因此,如果图像小于imageview,则图像视图的左右两侧会有空间。
如何缩放图像,以使图像视图根据图像的大小调整自身大小,并且背景中没有空白空间?
我尝试添加高度限制并更改代码中的常量值。 我已经在线尝试了大多数解决方案,但是没有用。
任何帮助将不胜感激,谢谢。
将imageview内容模式设置为居中并删除前导和尾随布局,而可以使用水平和垂直居中布局。
[英]How to scale the image to fit the image view in ios?
[英]UIButton image resize/scale to fit
[英]How to resize a large image and make it fit into UIButton in swift?
[英]How to Resize image in Swift?
[英]How to clip image in scale in iPhone?
[英]image won't scale in iPhone portrait view
[英]Image won't fit in scale to fill mode in image view
[英]How to fit video preview to fill Image View Xcode Swift 3
[英]Scale to fit cuts image
[英]iOS How to resize image at table view cell Swift
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.