UIView drawRect рисует линии неправильной ширины

Я пытаюсь добавить небольшую красную линию в нижней части моего UIView.

Я хочу, чтобы линия была строкой в ​​1 пиксель.

Кто-нибудь может сказать мне, почему следующий код:

- (void)drawRect:(CGRect)rect {
CGContextRef currentContext = UIGraphicsGetCurrentContext();
CGContextSaveGState(currentContext);
CGContextSetRGBFillColor(currentContext, 0.0f, 0.0f, 0.0f, 1.0f);
CGContextFillRect(currentContext, RECT(0, 0, rect.size.width, rect.size.height - 8));
CGContextSetLineWidth(currentContext, 1);
CGContextSetRGBStrokeColor(currentContext, 1.0f, 0.0f, 0.0f, 1.0f);
CGContextBeginPath(currentContext);
CGContextMoveToPoint(currentContext, 0, rect.size.height - 7);
CGContextAddLineToPoint(currentContext, rect.size.width, rect.size.height - 7);
CGContextStrokePath(currentContext);
CGContextRestoreGState(currentContext);
}

Рисует линию шириной 2 пикселя?

5
задан almosnow 21 August 2012 в 12:01
поделиться