title: Reflecting UIView changes after drawing
body: <p>How can I reflect UIView changes of a <code>setNeedsDisplay</code>?</p>
  
  <p>In <code>drawRect</code> triggered by <code>setNeedsDisplay</code></p>
  
  <pre><code>- (void)drawRect:(CGRect)rect {
     double i = 0;
     for(...)
     //i is incremented
         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(i * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                  drawStuff(element, context);
         });
  </code></pre>
  
  <p>For example, each draw update would happen after 1s, 2s, 3s, ...</p>
  
  <p><code>DrawStuff</code> switches back to the main thread with </p>
  
  <pre><code>dispatch_async(dispatch_get_main_queue(), ^(void) { ...
  </code></pre>
  
  <p>when updating the UI. I have tried both <code>UIBezierPath</code> and <em>Core Graphics</em> and get the same results. I am also using <code>UIGraphicsPushContext</code> and <code>UIGraphicsPopContext</code> to get the correct context. </p>
  
  <p>Using NSLog, I can tell the drawStuff is called in the 1s increments. However, the visible UIView remains unchanged. I can rotate the device screen and this will reposition the UIView and change its size. On rotation the UIView will reflect what it has currently drawn, but then I need to rotate it again to see the updated state after a few seconds. </p>
  
  <p>Back to the question above, is there a call to tell UIView to display its current graphics after <code>setNeedsDisplay</code>? Thanks. </p>