Reputation: 133
In my tableviews custom cell I have an image:
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).
Upvotes: 1
Views: 3168
Reputation: 1623
This is working for me I am have checked clipsToBound in the .xib file
imageView.layer.cornerRadius = 50
Upvotes: 1