Reputation: 356
I've created a simple app and dragged a UICollectionView
onto it. There is one cell, I've given it an ID of cell and added a label to it. I've also changed the background color of the collectionview
and the cell.
When I run the app in the simulator the collectionview
is there but the cell is not.
I have no Idea what i'm doing wrong an i'm starting to get really pissed off.
class ViewController: UIViewController, APExpandingTextViewDelegate,UICollectionViewDataSource,UICollectionViewDelegate {
...
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 1;
}
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as! UICollectionViewCell
return cell;
}
Nothing ever shows up.
Upvotes: 0
Views: 479
Reputation: 3219
Check datasource and delegate of collection view are connected or not in storyboard.
Upvotes: 2