title: How to draw signature with lines on iPhone screen?
body: <p>I want to let user draw a signature on iPhone screen, so I add a subclass of UIView and add some code to its 'touchesMoved' method. </p>
  
  <pre><code>
  -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
  {
      UITouch *touch = [touches anyObject];
      firstTouch = [touch locationInView:self];
  
      CGSize mySize = CGSizeMake(5, 5);
      UIGraphicsBeginImageContext(mySize);                                    
      CGContextRef ctx = UIGraphicsGetCurrentContext();                       
  
      CGContextBeginPath(ctx);                                                
      CGContextSetRGBFillColor(ctx, 1, 0, 0, 1);                              
      CGContextAddRect(ctx, CGRectMake(0, 0, 5, 5));                          
      CGContextFillPath(ctx);                                                 
  
      UIImage *redRect = UIGraphicsGetImageFromCurrentImageContext();         
      UIGraphicsEndImageContext();                                            
  
      UIImageView *redRectView = [[UIImageView alloc] initWithImage:redRect]; 
      redRectView.center = CGPointMake(firstTouch.x, firstTouch.y);                               
      [self addSubview:redRectView];                                      
  
  }
  
  </code></pre>
  
  <p>I'm drawing it with small rectangles and it turns out to be dot by dot. As it is too ugly, I want to draw the signature with lines. But how to distinguish firstTouch and lastTouch? If I only use 'touchesMoved' method, I can only get one touch point.</p>