title: Setting the background color of a UIVIew
body: <p>EDIT: People keep visiting this post which doesn't have much good information so I'll put this here to help you guys:
  Try setting the <code>backgroundColor</code> property of your <code>UIView</code>.  For example:</p>
  
  <pre><code>myView.backgroundColor = [UIColor blueColor];
  </code></pre>
  
  <p>Make sure your view has been instantiated and if it is controlled by an xib or storyboard at all, make sure that the view has already been loaded (otherwise whatever is set in interface builder will become the background color).  If that doesn't work, something weird is going on.  Keep looking, this post won't help you.</p>
  
  <p>Original post:</p>
  
  <p>I have an NSObject with a UIView property.  Mostly I use this UIView for displaying a picture, but in some cases, I want to set the background color of it.  However, each time I try to set the background color, the color stays as clear.  Any images or other subviews appear but the background does not.  How can I change the background color of a UIView?  Here is some of my code:</p>
  
  <p>here is an example where I need a tiled image:
  (this is in a function called after I add the UIView to the viewcontroller's view)</p>
  
  <p>(picture is a UIView Property)</p>
  
  <pre><code> picture.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Tile.png"]];
  </code></pre>
  
  <p>I have also tried in other cases:</p>
  
  <pre><code>picture.backgroundColor = [UIColor colorWithRed:0 green:1 blue:1 alpha:0.5];
  </code></pre>
  
  <p>In both cases, the background remains clear.</p>