How to set rounded corner for Uiimageview in Collectionview cell

Viewed 3280

I am trying to make a UICollectionviewCell as per the following design

enter image description here

I have set corner radius for the cell, but when data is loaded on the collectonview the imageview is not getting rounded corners. The output that i am getting is as follows

enter image description here

Rounded corners are getting applied to the cells but not to the images. Here is the code that i am applying. The code is applied on collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell

cell.layoutIfNeeded()

cell.layer.cornerRadius      = 15

cell.imageView.clipsToBounds = true

cell.layer.masksToBounds     = true

Can someone help me to solve this issue.

Thanks in advance....

4 Answers
Related