My UIImageView
doesn't appear rounded util scrolling or reload the collection view (collectionView.reloadData()
).
This is how it looks:
- Without rounding
- With rounding
The cell has multiple image views and all of them are constrained to go with facesContainer
UIView constrains.
I tried to implement this code is inside collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath)
:
cell.facesContainer.layer.cornerRadius = (cell.facesContainer.layer.frame.width/2)
cell.facesGroupImageView.layer.cornerRadius = (cell.facesGroupImageView.layer.frame.width/2)
cell.facesGroupImageView.layer.masksToBounds = true
cell.facesGroupImageView.layer.borderColor = UIColor.black.cgColor
cell.facesGroupImageView.layer.borderWidth = 0.5
Also, I tried to add the code snippet above in the custom cell class, at awakeFromNib()
method, but it doesn't work.
Why it doesn't work? how to fix it?