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
Problem is with setting the title to button, use the following code.
override func
collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
var cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as! UICollectionViewCell
var button = cell.viewWithTag(1) as! UIButton
//button.titleLabel?.text = Array[indexPath.row]
button.setTitle(Array[indexPath.row], forState: UIControlState.Normal)
return cell
}
Hope it helps