I want to display as many collectionViewCells
with buttons
as there are strings in my array. but when I start the simulator there is just the backgroun
func layoutCells() {
let layout = UICollectionViewFlowLayout()
layout.sectionInset = UIEdgeInsets(top: 0, left: 10, bottom: 10, right: 10)
layout.minimumInteritemSpacing = 5.0
layout.minimumLineSpacing = 5.0
layout.itemSize = CGSize(width: (UIScreen.mainScreen().bounds.size.width - 40)/3, height: ((UIScreen.mainScreen().bounds.size.width - 40)/3))
collectionView!.collectionViewLayout = layout
}
Try this. Call this function from view did load. I think the problem is that your collection is not laid out correctly.
func viewDidLoad() {
layoutCells()
}
If this works you can modify the layout options to meet your needs.