title: How to get transparency in certain areas of UIView subclass with drawRect override
body: <p>I've got a <code>UIView</code> subclass with <code>drawRect</code> overridden.  The drawing code does not fill the whole area of the view; some of it is meant to be transparent.  But when it draws onscreen, what should be transparent is black.  <b>How do I get it to be properly transparent?</b></p>
  
  <p>If I set the <code>backgroundColor</code> to <code>[UIColor clearColor]</code>, the whole view disappears.  If I set it to any other color, the black area changes to that color.  Setting <code>opaque</code> to <code>NO</code> has the same effect.  If I draw a transparent rectangle at the start of <code>drawRect</code> like below:</p>
  
  <pre><code>[[UIColor clearColor] setFill];
  UIRectFill( rect );
  </code></pre>
  
  <p>...then it goes to black again.  I can use another color in the above code and it draws that color.  If I make the color I use partially transparent, I can see the black showing through.</p>
  
  <p><B>UPDATE:</B> It may be relevant that my view has transparency gradients.  I tried testing with a really simple <code>UIView</code> subclass that just draws a blue rectangle inside its bounds and leaves everything else transparent.  Setting that view to <code>opaque=NO</code> renders as expected.</p>