1

In my tableviews custom cell I have an image:

Image of my tableview

I want to get the cornerRadius = 20. But for some reason it won't work I have used this code:

cell.offerImage.layer.cornerRadius = 20
cell.offerImage.clipsToBounds = true

And the Imageviews content mode is Aspect Fit. It is funny, because I tried to play around with it, and when I used:

cell.offerImage.layer.cornerRadius =  cell.offerImage.frame.size.width / 2

I got some weird cornerRadius, not the round as I expected. It is like the cornerRadius is on the imageView and not the image, and I dont know the precise size of the image (uploaded from server).

0

2 Answers 2

1

This is working for me I am have checked clipsToBound in the .xib file

imageView.layer.cornerRadius = 50
0

You need to add

imageView.clipsToBounds = true

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.