2012-11-17 59 views
0

我有一個大小爲20的數組作爲數據源的UICollectionViewController。UICollectionView顯示太少的單元格

但是當我運行它時,我只看到8個單元格。 NSLog的顯示計數仍然是20.

這是不夠的嗎?

- (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section; 

{

return self.datasource.count; 

}

+0

您爲您的收藏視圖使用了什麼佈局?也許它認爲它只能在屏幕上顯示8位 – simon

回答

0

你是怎麼在以下兩個委託方法設置?

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView 
    { 
     return TotalItems/NoOfItemsPerSection; 
    } 

    - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 
    { 
     return NoOfItemsPerSection; 
    } 
+0

numberOfSections有「返回1;」並且numberOfItemsInSection有「return self.dataSourceArray.count」 –

+0

請檢查將「numberOfItemsInSection」設置爲2.並將「numberOfSectionsInCollectionView」設置爲(self.datasource.count/2) –

相關問題