title: Using UIGraphicsGetCurrentContext properly
body: <p>II have a UIView into which I am placing 3  subviews, all instances of the same UIView, next to each other horizontally, filling each with a grey background. I got it to work for the first view but am having trouble with the second. Here is the drawRect code that is supposed to do the trick..</p>
  
  <pre><code>- (void)drawRect:(CGRect)rect {
          // grab current graphics context
      CGContextRef g = UIGraphicsGetCurrentContext();
  
         // fill grey background
      CGContextSetRGBFillColor(g, (207.0/255.0), (207.0/255.0), 211.0/255.0, 1.0);
      CGContextFillRect(g, self.frame);
  
  }
  </code></pre>
  
  <p>So from my view controller I am creating the first subview with frame.origin.x = 0, and adding it to my main view, then creating the second with the frame.origin.x set to the width of the first and adding it, then the third.</p>
  
  <p>The first view gets filled properly, but the second and third have black backgrounds as if the grey fill did not happen. I suspect that this is because I am not getting the context properly for the 2nd and 3rd subviews.</p>
  
  <p>What do I have to do to make this work?</p>
  
  <p>John</p>