title: iOS : Repositioning UIGraphicsBeginImageContext and UIImageView
body: <p>I've got code that allows me to draw on top of a UIImageView 
   - but I want to be able to limit the drawing area. </p>
  
  <p>I've been able to limit the size, but now I'm unable to position it: if i change (0, 0) to anything else my image disappeared completely and the ability to draw stops working </p>
  
  <p>drawImage - is a UIImageView</p>
  
  <pre><code>- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
      mouseSwiped = YES;
  
      UITouch *touch = [touches anyObject];
      currentPoint = [touch locationInView:self];
  
      UIGraphicsBeginImageContext(CGSizeMake(560, 660));
      [drawImage.image drawInRect:CGRectMake(0, 0, 560, 660)];
  
      CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
      CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0);
      CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 0, 1, 0, 1);
      CGContextBeginPath(UIGraphicsGetCurrentContext());
      CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
      CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
      CGContextStrokePath(UIGraphicsGetCurrentContext());
  
      [drawImage setFrame:CGRectMake(0, 0, 560, 660)];
      drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
      UIGraphicsEndImageContext();
      lastPoint = currentPoint;
  
      [self addSubview:drawImage];
  } 
  </code></pre>
  
  <p>any help is very much appreciated </p>