title: CGContextStrokePath not working when zooming and drawing images
body: <p>I'm drawing lines according to <code>touchesMoved:</code> method and normally it works fine. But when I zoom into the image and draw, the previously drawn lines are both displaced and keep getting more and more blurry, ultimately vanishing. I've tried using <code>UIPinchGestureRecognizer</code> and simply increasing the <code>frame</code> of <code>myImageView</code> (for multi-touch events only) but the problem occurs both ways. Here's the code for drawing:</p>
  <pre><code>- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
   NSArray *allTouches = [touches allObjects];
   int count = [allTouches count];
   if(count==1){//single touch case for drawing line
      UITouch *touch = [touches anyObject];   
      CGPoint currentPoint = [touch locationInView:myImageView];
      UIGraphicsBeginImageContext(myImageView.frame.size);
      [drawImage.image drawInRect:CGRectMake(0, 0, myImageView.frame.size.width, myImageView.frame.size.height)];
      CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
      CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 2.0);
      CGContextBeginPath(UIGraphicsGetCurrentContext());
      CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
      CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
      CGContextStrokePath(UIGraphicsGetCurrentContext());
      drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
      UIGraphicsEndImageContext();
      lastPoint = currentPoint;
   }
  else{//multi touch case
     // handle pinch/zoom
    }
  }
  </code></pre>
  <p>Here is the image drawn over without zooming:</p>
  <p><img src="https://i.stack.imgur.com/kfNQI.png" alt="enter image description here" /></p>
  <p>And this is the image depicting the problem after zooming-in with the red arrow showing the segment that was already drawn before zooming-in (as shown in previous image). The image is both blurred and displaced:</p>
  <p><img src="https://i.stack.imgur.com/wpvua.png" alt="enter image description here" /></p>
  <p>It can also be noticed that a part of the line drawn towards the end is unaffected and the phenomenon occurs for lines drawn back in time. I believe the reason for this is that the image size attributes are being lost when I zoom in/out which probably causes the blur and shift, but I'm not sure about that!</p>
  <p><strong>EDIT</strong>- I've uploaded <a href="http://tinypic.com/player.php?v=ivbkn5&amp;s=5" rel="nofollow noreferrer">a short video</a> to show what's happening. It's sort of entertaining...</p>
  <p><strong>EDIT 2-</strong> Here's <a href="http://cl.ly/3e2E3I1F400k3V1v3F0S" rel="nofollow noreferrer">a sample single-view app</a> focussing on the problem.</p>