2016-04-05 73 views
0

我有一個UICollectionView,它可以水平滾動。每個單元格都充滿了屏幕。當我滾動單元格時,在我的CollectionView中留有邊距。越滾動,邊距增加了次數。 the left in the pic is the margin instead of not full of the width of the device 必須有一些參數我沒有設置。任何人都可以幫助我。謝謝。UICollectionView Scroll無法正確分頁

+0

把你的一些代碼來了解您的問題...! –

+0

保證金是在屏幕左邊緣與收藏視圖之間還是在收藏視圖內? – MudOnTire

回答

1
- (CGFloat)collectionView:(UICollectionView *)collectionView 
        layout:(UICollectionViewLayout *)collectionViewLayout 
     minimumLineSpacingForSectionAtIndex:(NSInteger)section { 
    return 0;  
} 
0

使用這些方法之下,UICollectionView正確設置分頁及其對我的工作,

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section 
{ 
    return 0.0; 
} 

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section 
{ 
    return 0.0; 
} 

- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section 
{ 

    return UIEdgeInsetsMake(0, 0, 0, 0); 
} 

希望它有幫助