【发布时间】:2013-08-27 00:11:21
【问题描述】:
我正在尝试画一条简单的线,问题是它的宽度不是 1 像素,而是 2。文档指出,如果我正确阅读,用户空间单位将转换为像素。
代码很简单,但我的线总是 2 像素宽。
//Get the CGContext from this view
CGContextRef context = UIGraphicsGetCurrentContext();
//Set the stroke (pen) color
CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor);
//Set the width of the pen mark
CGContextSetLineWidth(context, 1);
for (int i = 1; i <= sections - 1; i++)
{
UIBezierPath *path = [UIBezierPath bezierPath];
[path moveToPoint:CGPointMake(0.0, i * kSectionHeight)];
CGContextMoveToPoint(context, 0.0, i * kSectionHeight); //Start point
CGContextAddLineToPoint(context, self.frame.size.width, i * kSectionHeight);
}
CGContextStrokePath(context);
【问题讨论】:
标签: ios quartz-core