2015-11-07 78 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

相關問題