title: How to use DrawRect correctly
body: <p>Im currently building Custom <code>UIActivityIndicator</code>. In order to do that I created the following draw rect function:</p>
  
  <pre><code>-(void) drawRect:(CGRect)rect  
  {
  CGPoint point;
  NSLog(@"here %d",stage);`
  
  CGContextRef ctx = UIGraphicsGetCurrentContext();
  CGContextSetLineWidth(ctx, 2.0);
  
  for (int i = 1 ; i&lt;=10; ++i) {
  
  
      CGContextSetStrokeColorWithColor(ctx, [[self getColorForStage:stage+i WithAlpha:0.1 *i] CGColor]);
      point = [self pointOnOuterCirecleWithAngel:stage+i];
      CGContextMoveToPoint(ctx, point.x, point.y);
      point = [self pointOnInnerCirecleWithAngel:stage+i];
      CGContextAddLineToPoint( ctx, point.x, point.y);
      CGContextStrokePath(ctx);
  }
  
  
  
  stage++;
  }
  </code></pre>
  
  <p>And i added an <code>NSTimer</code> to call <code>[self setNeedsDisplay];</code></p>
  
  <p>The animation works fine BUT when I import it to my application every time i will scroll a table or do anything the animation will stop until the table stops moving.</p>
  
  <p>I assume that only after the UI finish to update it update my DrawRect but how can I work around it OR do it the right way</p>