2013-12-11 107 views
0

我新的iOS開發,IOS集合視圖

我設計,我想使用集合視圖控件的放置位置的接口,如果在一個網格,

對於這一點,我「使用集合中號中所示的圖片下面

enter image description here

然而,在運行時,該屏幕顯示完全黑色:

enter image description here

我期待看到我在第一張圖片中設計的界面。但爲什麼界面顯示爲全黑?

+1

你是什麼緊急情況的性質? – Alexander

+1

編輯,問題 – Noor

+0

請顯示集合視圖數據源和委託協議實現。 – Alexander

回答

1

UIcollectionView的默認顏色會看起來像黑色只有當你想使其可見嘗試改變UicollectionView的觀顏色,你想看到您的網格佈局意味着委託和數據源連接您的收藏查看和使用集合視圖委託功能。

-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView 
{ 
    return 1; 
} 

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { 
    return 10; 
} 


- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ 
    static NSString *identifier = @"Cell"; 

    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath]; 

    return cell; 
} 

,這是很好的教程Uicollection視圖Look at this link