2015-11-07 80 views
0

我创建了一个简单的应用程序,并将其拖动到一个UICollectionView上。有一个单元格,我给它一个单元格ID并为其添加标签。我也改变了collectionview和单元的背景颜色。 当我在模拟器中运行应用程序时,collectionview在那里,但单元格不在。 我不知道我在做什么错我开始变得非常生气。UICollectionView内置IB,不显示单元格

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; 

} 

什么事也没显示出来。在IB IB Layout of UICollectionView

+1

@ user1089677你有没有检查IB的数据源和集合视图的委托? –

+0

谢谢!我一直在寻找太久的答案,并最终导致了这种情况。 – user1086377

回答

2

检查数据源和收集鉴于委托

屏幕截图故事板连接与否。 enter image description here

相关问题