Prechádzať zdrojové kódy

fix downscaling of avatar images in chat list, group view etc. (#226)

cyberta 5 rokov pred
rodič
commit
e8f71c3d93
1 zmenil súbory, kde vykonal 5 pridanie a 3 odobranie
  1. 5 3
      deltachat-ios/View/ContactCell.swift

+ 5 - 3
deltachat-ios/View/ContactCell.swift

@@ -165,9 +165,11 @@ class ContactCell: UITableViewCell {
     }
 
     func setImage(_ img: UIImage) {
-        let attachment = NSTextAttachment()
-        attachment.image = img
-        initialsLabel.attributedText = NSAttributedString(attachment: attachment)
+        if let resizedImg = img.resizeImage(targetSize: CGSize(width: initialsLabelSize, height: initialsLabelSize)) {
+            let attachment = NSTextAttachment()
+            attachment.image = resizedImg
+            initialsLabel.attributedText = NSAttributedString(attachment: attachment)
+        }
     }
 
     func setBackupImage(name: String, color: UIColor) {