-1

enter image description here

I tried to remove CollectionView Cell bottom border but no luck. As attached is my sample code:-

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    UICollectionViewCell *gridcell = nil;

    MenuDetail_Cell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:MenuDetail_CellID forIndexPath:indexPath];

    cell.layoutMargins = UIEdgeInsetsZero;
    cell.layer.borderWidth = 0;
    cell.clipsToBounds = YES;
    cell.contentView.layer.borderWidth = 0.0;
    cell.contentView.layer.borderColor = [UIColor clearColor].CGColor;
    cell.contentView.layer.masksToBounds = NO;

    cell.strMenuImage = self.imageArray[indexPath.row];
    cell.strMenuTitle = self.titleArray[indexPath.row];
    gridcell = cell;
    return gridcell;
}


- (UICollectionView *)collectionView
{
    if (!_collectionView) {

        UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init];

        _collectionView = [[UICollectionView alloc]initWithFrame:CGRectZero collectionViewLayout:layout];
        _collectionView.delegate = self;
        _collectionView.dataSource = self;
        _collectionView.delaysContentTouches = NO;


            _collectionView.frame = CGRectMake(0, DCTopNavH, ScreenW, ScreenH  - DCBottomTabH);

        _collectionView.showsVerticalScrollIndicator = NO;

        //Cell
        [_collectionView registerClass:[MenuDetail_Cell class] forCellWithReuseIdentifier:MenuDetail_CellID];


        [self.view addSubview:_collectionView];
    }
    return _collectionView;
}

Even I tried to apply minimumLineSpacingForSectionAtIndex but still the same. Any idea? Sorry for my stupid mistake if any. Thank you.

AD Tee
  • 345
  • 4
  • 21
  • @Dimple, my case is using objective c , so i hit `Property 'separatorColor' not found on object of type 'UICollectionVi` error here. – AD Tee Oct 03 '18 at 10:36
  • Try `cell.layer.borderColor = [UIColor clearColor].CGColor;` – Kuldeep Oct 03 '18 at 10:48
  • 1
    Its difficult to predict why this line is showing up can you add a pic of your view hierarchy using xcode's Debug View Hierarchy. – nishith Singh Oct 03 '18 at 10:49
  • @nishithSingh, thanks for your idea, I found my prob via Debug View Hierarchy – AD Tee Oct 03 '18 at 11:04

1 Answers1

2

UICollectionView do not have a separator like UITableView

It should be in your code somewhere, check out your storyboard of MenuDetail_Cell class

Satish
  • 2,015
  • 1
  • 14
  • 22