I used this example to draw dashed line on uiview
:
UIBezierPath *path = [UIBezierPath bezierPath];
//draw a line
[path moveToPoint:yourStartPoint]; //add yourStartPoint here
[path addLineToPoint:yourEndPoint];// add yourEndPoint here
[path stroke];
float dashPattern[] = {1,1,1,1}; //make your pattern here
[path setLineDash:dashPattern count:4 phase:0];
UIColor *fill = [UIColor blueColor];
shapelayer.strokeStart = 0.0;
shapelayer.strokeColor = fill.CGColor;
shapelayer.lineWidth = 7.0;
shapelayer.lineJoin = kCALineJoinMiter;
shapelayer.lineDashPattern = [NSArray arrayWithObjects:[NSNumber numberWithInt:10],[NSNumber numberWithInt:10], nil];
shapelayer.lineDashPhase = 3.0f;
shapelayer.path = path.CGPath;
it works, but problem is that even though I set my uiview
height 1, the line I get is quite thick.
is it possible to make it thinner?