如何删除 UICollectionView 单元格中具有透明背景的底部边框线?
How to remove bottom border line with transparent background in my UICollectionView cell?
我尝试删除 CollectionView Cell 底部边框,但没有成功。
附件是我的示例代码:-
- (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;
}
即使我尝试申请 minimumLineSpacingForSectionAtIndex
但还是一样。
任何的想法?对不起,如果有的话,我的愚蠢错误。谢谢。
UICollectionView 没有像 UITableView 那样的分隔符
它应该在您的代码中某处,请查看您 MenuDetail_Cell
class
的故事板
我尝试删除 CollectionView Cell 底部边框,但没有成功。 附件是我的示例代码:-
- (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;
}
即使我尝试申请 minimumLineSpacingForSectionAtIndex
但还是一样。
任何的想法?对不起,如果有的话,我的愚蠢错误。谢谢。
UICollectionView 没有像 UITableView 那样的分隔符
它应该在您的代码中某处,请查看您 MenuDetail_Cell
class