I want to draw a straight dotted line and i tried the following code
CGSize size = CGSizeMake(screenWidth, screenHeight);
UIGraphicsBeginImageContext(size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetStrokeColorWithColor(context, [[UIColor whiteColor] CGColor]);
CGContextSetFillColorWithColor(context, [[UIColor clearColor] CGColor]);
CGContextSetLineWidth(context, 5.0f);
CGContextMoveToPoint(context, 0, 0);
CGContextAddLineToPoint(context, screenWidth,screenHeight);
CGContextStrokePath(context);
But this code shown like this
How can i get straight line.