jacobsieradzki
jacobsieradzki

Reputation: 1108

Really strange behaviour with self.imageView.clipsToBounds = YES

I have a UIImageView with a picture but it is going over the frame of the picture since it is set to Aspect Fill Content Mode. So I tried setting:

self.imageView.clipsToBounds = YES

but after this I get really strange behaviour that the image will turn to this rhombus in the middle of the imageView. I have tried it with two different images and it is the same problem.

Here is before and after clipsToBounds images: (ignore the my profile behind it)

before after

Upvotes: 0

Views: 253

Answers (1)

Zhang
Zhang

Reputation: 11607

I think you've set the cornerRadius property to something quite high.

Try changing your:

self.imageView.layer.cornerRadius = 0;

Or remove any line that specify a cornerRadius that isn't 0.

Upvotes: 2

Related Questions