0
我有一个任务在UIView单元之间绘制一个2px高度的分隔线。因此,在具有Retina显示器的iPhone模拟器上,在iPad模拟器上可以清楚地看到这两条线条以不同的颜色(#F1F1F1和#DDDDDD部分)清晰可见(#F1D1D2DDDDD部分) - 线条失真,并且没有这种颜色的线条。用于绘制例如线在iPad上画线的奇怪问题
代码片段:
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGContextSetLineWidth(context, 1.);
CGContextSetStrokeColor(context, CGColorGetComponents(
[[GlobalHelper colorFromHexRGB:@"#F1F1F1"] CGColor]));
CGContextMoveToPoint(context, 0., line_y);
CGContextAddLineToPoint(context, rect.size.width, line_y);
CGContextStrokePath(context);
CGContextRestoreGState(context);
CGContextSaveGState(context);
CGContextSetLineWidth(context, 1.);
CGContextSetStrokeColor(context,
CGColorGetComponents([[GlobalHelper colorFromHexRGB:@"#DDDDDD"] CGColor]));
line_y += 1.;
CGContextMoveToPoint(context, 0., line_y);
CGContextAddLineToPoint(context, rect.size.width, line_y);
CGContextStrokePath(context);
CGContextRestoreGState(context);
对于查看对象,它用作绘图线保持器(这是的UITableViewCell的子类)。我试着改变参数“opaque”和“clearsContextBeforeDrawing”。同样的结果 - iPhone Retina一切正常,iPad - 线路失真。
什么是造成这种情况,以及如何解决它的任何想法?