title: UIBezierPath to draw straight lines
body: <p>Here is the relevant .m that I am currently using. </p>
  
  <pre><code>- (void)drawRect:(CGRect)rect
  {
  
      [[UIColor redColor] setStroke];
      for (UIBezierPath *_path in pathArray) 
      [_path strokeWithBlendMode:kCGBlendModeNormal alpha:1.0];    
  
  
  }
  
  #pragma mark -
  #pragma mark - Touch Methods
  
  
  -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
  {
      myPath=[[UIBezierPath alloc]init];
  
  
      NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
  
      if([ud objectForKey:@"lineThickness"] == nil) {
          myPath.lineWidth=5;
      }
      else {
  
          float thicknessFloat = [ud floatForKey:@"lineThickness"];
          myPath.lineWidth= 10. * thicknessFloat;
  
  
      }
  
      UITouch *mytouch=[[touches allObjects] objectAtIndex:0];
      [myPath moveToPoint:[mytouch locationInView:self]];
      [pathArray addObject:myPath];
  
  }
  -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
  {
  
      UITouch *mytouch=[[touches allObjects] objectAtIndex:0];
      NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
  
      if([ud objectForKey:@"lineThickness"] == nil) {
          myPath.lineWidth=5;
      }
      else {
  
          float thicknessFloat = [ud floatForKey:@"lineThickness"];
          myPath.lineWidth= 10. * thicknessFloat;
  
  
      }
      [myPath addLineToPoint:[mytouch locationInView:self]];
      [self setNeedsDisplay];
  
  }
  </code></pre>
  
  <p>It works great, but since this is tutorial code that is slightly modified by me, I do not know how to approach the problem of wanting to draw lines between two points, and have the framework connect the the points each time a point is added.</p>
  
  <p>Can anyone please point me in a good direction on how to accomplish this please? </p>