title: trouble setting NSWindow and UIView BackgroundColor in a loop within a method
body: <p>I have great trouble setting background color for NSWindow (Mac OS X) and UIView (iOS) within a method or in a loop. 
      Following code of setting background color only works for the last line of code in loop, which is when all values of i, j, k are 255, as screen turn to white as a proper mixture of RGB. </p>
  
  <pre><code>`- (void) ChangeColorLoop
  {
  for (int i=0; i&lt;=255; i++)
      for (int j=0; j&lt;=255; j++)
          for (int k=0; k&lt;=255; k++)
          {
              [NSThread sleepForTimeInterval: 0.1];
              //NSLog(@"%d, %d, %d", i, j, k);
              float red = (float) i/255;
              float green = (float) j/255;
              float blue = (float) k/255;    
              float alpha = 1.0f;
              UIColor *mixedColor = [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
              //BackgroundView.backgroundColor = mixedColor;
              [BackgroundView setBackgroundColor:mixedColor];
          }
  }`
  </code></pre>
  
  <p>Thanks in advance, </p>
  
  <p>Jerry</p>