今天做公司产品的时候遇到了如题问题,困扰我很长时间,用尽各种办法不能解决,究其原因不知为何,自定义cell低端有view划线的时候,划线一般的显示1像素,而贴着section的显示很少 顶多0.3像素,这个问题很头疼,后来 想到了一个非常好的办法解决:
UIImageView *separatorLine = [[UIImageViewalloc]initWithFrame:CGRectMake(20.0f*SizeScaleX,30*SizeScaleY -1.0f, cell.frame.size.width,1.0f)];
separatorLine.image = [[UIImageimageNamed:@"所有背景.png"]stretchableImageWithLeftCapWidth:1topCapHeight:0];
separatorLine.tag =5554;
[cell.contentViewaddSubview:separatorLine];
再做判断
if(indexPath.row == arr.count-1){
UIImageView *separatorLine = (UIImageView *)[cellviewWithTag:5554];
separatorLine.hidden =YES;
}else{
UIImageView *separatorLine = (UIImageView *)[cellviewWithTag:5554];
separatorLine.hidden =NO;
}