0
votes

i have a UICollectionView and it can horizontal scroll. every cell is full of the screen.when i scroll the cell there are left margin in my CollectionView.the more i scroll ,the margin increase by times.the left in the pic is the margin instead of not full of the width of the device there must be some parameters i didnt set up .can anybody help me .Thanks.

2
put your some code to understand your issue...!! - Yagnesh Dobariya
the margin is between the left edge of screen and the collection view or inside the collection view? - MudOnTire

2 Answers

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

Use these below methods, UICollectionView set Paging correctly and its work for me,

- (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);
}

hope its helpful