title: Drawing multiple rectangles in a view without using drawRect:
body: <p>I have this code which makes multiple rectangles in a <code>UIView</code>:</p>
  
  <pre><code>CGContextRef ctx = UIGraphicsGetCurrentContext();
  
  CGContextSetLineWidth(ctx, 0.5);
  
  CGContextSetStrokeColorWithColor(ctx, [UIColor blueColor].CGColor);
  
  //newView.xPoints is always equal in count to the other two arrays below.    
  for (int i = 0; i &lt; [newView.xPoints count]; i++) 
  {
      CGFloat tx = [[newView.xPoints objectAtIndex:i]floatValue];
      CGFloat ty = [[newView.yPoints objectAtIndex:i]floatValue];
      CGFloat charWidth = [[newView.charArray objectAtIndex:i]floatValue];
  
      CGRect rect = CGRectMake(tx, (theContentView.bounds.size.height - ty), charWidth, -10.5);
      CGContextAddRect(ctx, rect);
      CGContextStrokePath(ctx);
  }
  </code></pre>
  
  <p>I tried it in <code>drawRect:</code> and it worked perfectly fine. However, I plan to use <code>drawRect:</code> for other purposes. So can anyone give me tips or hints on how to do it without using <code>drawRect:</code>?</p>