How to remove UIGraphicsImageRenderer UIImageView borderTue Jun 23 2020
This iOS issue sent me for a spin, hopefully you aren't facing this too.
To create a UIImage
from a UIView
in swift:
let renderer = UIGraphicsImageRenderer(size: myView.bounds.size)
let renderedImage = renderer.image { _ in
myView.drawHierarchy(in: myView.bounds, afterScreenUpdates: true)
}
This will leave you with a gray thin border around your UIImageView
with a transparent background. To solve this the UIImageView
requires a .background
color.