I\'m at a bit of a loss. I\'ve used the layer property of UIView to round the corners of multiple elements in my app. However, this one UIImageView is simply not complying.
You need to set the layer's masksToBounds
property to YES
:
cell.previewImage.layer.masksToBounds = YES;
This is because the UIImageView
control creates a pseudo-subview to hold the UIImage
object.
Try this code:-
self.imgaviewName.clipsToBounds = true
self.imageviewName.layer.cornerRadius = 10
I believe you need to set:
cell.previewImage.layer.masksToBounds = YES;
cell.previewImage.layer.opaque = NO;
For imageView.contentMode = .scaleAspectFill
the cornerRadius
is not applied if the image is very large, depending on the hardware.
Some tests with resized panorama images:
Try this below piece of code
cell.previewImage.layer.cornerRadius = 20;
cell.previewImage.clipsToBounds = YES;