I have an UIImageView
taking the whole screen except navigation bar. Besides, I have an UIView
with red border on top of UIImageView
. When "Done" button is clicked, I want image inside red border being cropped.
I tried hard to use CGImage.cropping(to: rect)
. But the rect I sent is just frame of UIView
with red border, which is different from rect of a cgImage
.
How could I send proper 'rect' parameter into cropping(to: rect)method of CGImage
instance to crop Image?