Closed hensch7 closed 2 years ago
Hey, thanks for reporting this issue. On a high level, the reason why the image is too big is because it's embedded in an NSMutableAttributedString
(as NSTextAttachment
) and not in a UIImageView
instance. I'll have to rethink the UI there and will fix that in a future update.
For the time being, you can...
or
UIImage
below.extension UIImage {
enum ContentMode {
case contentFill
case contentAspectFill
case contentAspectFit
}
func resize(withSize size: CGSize, contentMode: ContentMode = .contentAspectFill) -> UIImage? {
let aspectWidth = size.width / self.size.width
let aspectHeight = size.height / self.size.height
switch contentMode {
case .contentFill:
return resize(withSize: size)
case .contentAspectFit:
let aspectRatio = min(aspectWidth, aspectHeight)
return resize(withSize: CGSize(width: self.size.width * aspectRatio, height: self.size.height * aspectRatio))
case .contentAspectFill:
let aspectRatio = max(aspectWidth, aspectHeight)
return resize(withSize: CGSize(width: self.size.width * aspectRatio, height: self.size.height * aspectRatio))
}
}
private func resize(withSize size: CGSize) -> UIImage? {
UIGraphicsBeginImageContextWithOptions(size, false, self.scale)
defer { UIGraphicsEndImageContext() }
draw(in: CGRect(x: 0.0, y: 0.0, width: size.width, height: size.height))
return UIGraphicsGetImageFromCurrentImageContext()
}
}
Thank you for your support.
Hey,
I noticed, that when you put an image into the notice area, it doesn't get properly resized and is way too big. The images next to the bullet points get resized to fit, but the notice image is shown as is.
The only fix right now is manually downsizing the image, but it should work as it does with all other images.
Example: