title: How to remove space in painting using drawinrect?
body: <p>i'm using the following code to draw lines over an imageview's image,</p>
  
  <pre><code>- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
  UITouch *touch = [touches anyObject];
  if ([touch tapCount] == 2)
      return;
  lastPoint = [touch locationInView:imageview];
  }
  
  - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
      UITouch *touch = [touches anyObject];
      CGPoint currentPoint = [touch locationInView:self.view];
      CGContextSetLineCap(UIGraphicsGetCurrentContext(), 3);
      CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5);
      UIGraphicsBeginImageContext(self.view.frame.size);
      [imageview.image drawInRect:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
      CGContextClearRect(UIGraphicsGetCurrentContext(), CGRectMake(lastPoint.x, lastPoint.y, 5, 5));
      imageview.image = UIGraphicsGetImageFromCurrentImageContext();
      UIGraphicsEndImageContext();
  lastPoint = currentPoint;
  }
  </code></pre>
  
  <p>Output</p>
  
  <p><img src="https://i.stack.imgur.com/YnZWm.png" alt="enter image description here"></p>
  
  <p>You can see the gaps/spaces between the dots. I need the output should be like below,</p>
  
  <p><img src="https://i.stack.imgur.com/Md2fR.png" alt="enter image description here"></p>
  
  <p>What should I change in my code to remove the space between two dots?<br>
  I think, <code>touchesended</code> code is not needed for your review. I changed the CGContextSetLineCap and width, no luck.</p>