调整消息列表图片高度

This commit is contained in:
Fin 2025-05-23 09:47:34 +08:00
parent d16b0c8b4f
commit efe2f82964

View File

@ -183,12 +183,19 @@ extension MessageItemView {
}
func layoutImageView(image: UIImage) {
let scale = image.size.height / image.size.width
// iPad 500
let panelWidth = min(min(500, UIScreen.main.bounds.width - 32 - 24), image.width)
var width = min(min(500, UIScreen.main.bounds.width - 32 - 24), image.width)
var height = width * scale
if height > 400 {
width = 400 / scale
height = 400
}
imageView.snp.remakeConstraints { make in
make.width.equalTo(panelWidth)
make.height.equalTo(self.imageView.snp.width).multipliedBy(image.size.height / image.size.width)
make.width.equalTo(width)
make.height.equalTo(height)
}
}
}