While developing a rounded rectangle widget I encountered the following problem: path built with arcs looks ugly when stroked.
How to make the stroked arcs look nicer?
While developing a rounded rectangle widget I encountered the following problem: path built with arcs looks ugly when stroked.
How to make the stroked arcs look nicer?
One trick with quartz drawing is to offset things by half a pixel. Try insetting your rect before drawing:
rect = CGRectInset( rect , -0.5 , -0.5 );
Doing +0.5 instead of -0.5 would make the rectangle smaller.
Here's outline of the solution valid for any given line width:
- (void)drawRect:(CGRect)rect {
CGFloat lineWidth=1.5;
rect = CGRectInset(rect, lineWidth , lineWidth);
...
CGContextSetLineWidth(context, lineWidth);
...
}