2016-03-04 47 views
0

在我的項目,我有收藏,其中水平分頁啓用,每一件事工作正常,但,當我滾動,特別是電池項目不適合整個單元格,這表明前一小區的項目和半流項目的一半圖像,我需要項目,以適應整個屏幕?任何建議,歡迎在收集視圖中一次應該在屏幕上顯示一個項目?

下面是代碼:

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath; { 
    SingleItemCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"SingleItemCollectionViewCell" forIndexPath:indexPath]; 
    [cell ConfigaureCollectionViewItem:self.totalCellItems[indexPath.row]]; return cell; 
} 

-(CGSize)collectionView:(UICollectionView)collectionView layout:(UICollectionViewLayout)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { 
    CGSize size = CGSizeMake(self.bounds.size.width - 20, self.bounds.size.height - 40); 
    return size; 
} 
+0

請發表您的代碼,它很容易理解。 –

+0

如前所述,我們無法真正幫助您,無需在IB中查看一些代碼或設置。 – pajevic

+0

- (UICollectionViewCell *)的CollectionView:(UICollectionView *)的CollectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath; { SingleItemCollectionViewCell *細胞= [的CollectionView dequeueReusableCellWithReuseIdentifier:@ 「SingleItemCollectionViewCell」 forIndexPath:indexPath]; [cell ConfigaureCollectionViewItem:self.totalCellItems [indexPath.row]]; return cell; } –

回答

0

也許你應該在UICollectionView代替使用UIPageViewController。從你的問題看來,你似乎在試圖模仿前者的行爲。

+0

雅,我需要相同的行爲像頁面視圖控制器,但我需要使用集合視圖。那是問題..any想法,請提出me..I新來的IOS編程 –

+0

到底是什麼,你需要一個'UICollectionView的原因'。我並不是說這不是真的,但我很好奇這是爲什麼。 – pajevic

+0

其實在我的項目中,我有表視圖控制器,它是基本視圖控制器。在每個表格視圖中,我必須使用集合視圖。所以在第一個表格視圖單元格我需要頁面視圖控制器behavoro收集視圖和其他表格視圖單元格我需要集合查看行爲 –

相關問題