在我的項目,我有收藏,其中水平分頁啓用,每一件事工作正常,但,當我滾動,特別是電池項目不適合整個單元格,這表明前一小區的項目和半流項目的一半圖像,我需要項目,以適應整個屏幕?任何建議,歡迎在收集視圖中一次應該在屏幕上顯示一個項目?
下面是代碼:
- (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;
}
請發表您的代碼,它很容易理解。 –
如前所述,我們無法真正幫助您,無需在IB中查看一些代碼或設置。 – pajevic
- (UICollectionViewCell *)的CollectionView:(UICollectionView *)的CollectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath; { SingleItemCollectionViewCell *細胞= [的CollectionView dequeueReusableCellWithReuseIdentifier:@ 「SingleItemCollectionViewCell」 forIndexPath:indexPath]; [cell ConfigaureCollectionViewItem:self.totalCellItems [indexPath.row]]; return cell; } –