I have a tableview and in one of the rows, I have a custom cell which has a collection view with horizontal scroll. In the collection view cell I have the Image for which I have added rounded corners.
img_Photo.backgroundColor = UIColor.colorFromCode(0xf2f2f2)
img_Photo.layer.cornerRadius = img_Photo.frame.height / 2
img_Photo.layer.masksToBounds = true
The corner radius shows as below first and then on scrolling it looks proper. What am I missing to set this properly.
I have added layoutIfNeeded in the tableviewcell
override func layoutIfNeeded() {
super.layoutIfNeeded()
collectView.frame = self.contentView.bounds
}
Override layoutSubviews() inside your collection view cell class and set corner radius inside it.