I have been dealing with this issues for a few days now trying to figure out why images are clipping whenever I pick from the uiimagepicker. I have this button in my view controller that will take on the image that is chosen from the uiimagepicker. The image shows up but there is this weird clipping affect where it shows the entire image but there is this empty space that is black that makes the image look like it is being clipped. The image of what the issue I am dealing with is below: image of the current clipping issues
Asked
Active
Viewed 42 times
0
-
Any luck on finding a solution? Currently I'm having the same issue, the only difference is that my images are `clipped` at the top. Choosing an image form the PhotoLibrary works without issues. The issue only appears when I take a photo with the camera and when I do not edit it. The clipping disappears when I enable allowsEditting and zoom in after I take a photo. – Bacon Feb 25 '19 at 09:23
1 Answers
0
As now, your image view content mode is .fit that's why this is happening, For now, You need to set imageView content mode scaleAspectFill
:
imageView.contentMode = UIViewContentMode.scaleAspectFill
imageView.clipsToBounds = true

Jogendar Choudhary
- 3,476
- 1
- 12
- 26
-
What this is a button instead? The reason why I have it as a button is so that the user can reselect a photo for any reason. Thanks for your quick response! – Prentice Lathon Jun 03 '18 at 13:02
-
@PrenticeLathon Have you taken a button for showing a image? – Jogendar Choudhary Jun 03 '18 at 15:01
-
Yes, so when the user taps the button it shows the image picker. Once the image is selected I have the image that was selected becoming the button image using the setImage code... – Prentice Lathon Jun 04 '18 at 20:40
-
You have to use UIImageView and add Tap gesture on UIImage view. As you are using button so it's difficult to set image in a proper way, we can adjunst using UIImageInset on button But we have to use UIImage with tap gesture. Hope you undestand – Jogendar Choudhary Jun 05 '18 at 05:24