user1086377
user1086377

Reputation: 356

UICollectionView Built in IB not displaying cell

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.

screen shot of the IB IB Layout of UICollectionView

Upvotes: 0

Views: 479

Answers (1)

Bhavin Ramani
Bhavin Ramani

Reputation: 3219

Check datasource and delegate of collection view are connected or not in storyboard. enter image description here

Upvotes: 2

Related Questions