1 像素线的标准做法,但是在 iphone xs max 上闪动,有人遇到过吗?
代码如下:
#define SINGLE_LINE_WIDTH (1 / [UIScreen mainScreen].scale)
#define SINGLE_LINE_ADJUST_OFFSET ((1 / [UIScreen mainScreen].scale) / 2)
UIView *cellHeadLine = [[UIView alloc] initWithFrame:CGRectMake(cell.bounds.origin.x, cell.bounds.origin.y - SINGLE_LINE_ADJUST_OFFSET, cell.bounds.size.width, SINGLE_LINE_WIDTH)];
cellHeadLine.backgroundColor = [UIColor colorGreyBorder];
[cell addSubview:cellHeadLine];