[英]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.