IOS Horizontal CollectionView does not scroll fully

I have one line collectionviewthat scrolls horizontally. collectionviewworks, but it cuts off the second to the last cell (marked in orange) and hides the last cell.

I have 5 cells, each 166x166 in size. I checked contentsize viewlayoutand the width is 830, which is correct, but I can't scroll this far.

Here are the settings in the storyboard:

enter image description here

And here is the code for collectionview.

#pragma mark Collection View Methods

-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
    return 1;
}

-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return [array count];
}

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"FeaturedCell" forIndexPath:indexPath];

    UILabel *label = (UILabel *) [cell viewWithTag: 100];
    label.text = [array objectAtIndex:indexPath.row];

    [cell.layer setBorderWidth:2.0f];
    [cell.layer setBorderColor:[UIColor whiteColor].CGColor];

    return cell;
}
+4
source share
1 answer

IB - 600 . , . 320 , 240 , , 166 , , 1 1/2 . .

, 0 ( , "" ).

+2

All Articles