Reputation: 2314
I'm struggling to change the size of my UICollectionViewCell
programmatically.
I've tried this:
let columnLayout = FlowLayout(
itemSize: CGSize(width: 150, height: 150),
minimumInteritemSpacing: 10,
minimumLineSpacing: 10,
sectionInset: UIEdgeInsets(top: 20, left: 20, bottom: 10, right: 20))
But that doesn't work for me. Do I have to call this somewhere?
Upvotes: 0
Views: 57
Reputation: 100543
Try
self.collectionView.collectionViewLayout = columnLayout
inside viewDidLoad
lazy var columnLayout:FlowLayout = {
return FlowLayout(itemSize: CGSize(width:(self.view.frame.width - 40) / 2, height: 150),
minimumInteritemSpacing: 10,
minimumLineSpacing: 10,
sectionInset: UIEdgeInsets(top: 20, left: 20, bottom: 10, right: 20))
}()
Upvotes: 1