I have a UICollectionView
and I set it's cellSize in viewDidLoad
:
let cellWidth = self.view.frame.width / 2
self.collectionViewFlowLayout.itemSize = CGSize(width: cellWidth, height: 100)`
I try to add a gradient layer to my custom UICollectionViewCell
. But the frame size is the one I set from storyboard. I can't get the correct, calculated frame size in my UICollectionViewCell
subclass's layoutSubviews
method.
How am I going to get the correct frame size?