title: In Swift, drawRect for custom view is not updating properly
body: <p>Below is my drawRect function for a simple custom view.  When I use</p>
  
  <pre><code>var h: CGFloat = 200
  </code></pre>
  
  <p>the view displays itself properly: a rectangle part of which is black, part of which is red.  But when I use </p>
  
  <pre><code>var h: CGFloat = fractionalHeight*parentViewHeight
  </code></pre>
  
  <p>all I get is a black rectangle.  If <code>fractionalHeight</code> (a property of the view)
  is 0.5, half of the rectangle should be red. The print statement confirms the fact
  that h is what I think it should be.  Hmmmmm?  What's going on?</p>
  
  <pre><code>    override func drawRect(rect: CGRect)
  {
      var ctx = UIGraphicsGetCurrentContext()
  
      CGContextClearRect(ctx, rect);
  
      let parentViewBounds = self.bounds
      let parentViewWidth = CGRectGetWidth(parentViewBounds)
      let parentViewHeight = CGRectGetHeight(parentViewBounds)
      println ("w,h = \(parentViewWidth),\(parentViewHeight) ")
  
      // CGContextClearRect(ctx, rect);
  
      CGContextSetRGBFillColor(ctx, 0.0, 0.0, 0.0, 1); // black
      CGContextFillRect(ctx, CGRectMake(0, 0, parentViewWidth, parentViewHeight));
  
      println("in drawRect, fractionalHeight = \(fractionalHeight)")
  
      var h: CGFloat = 200 // fractionalHeight*parentViewHeight
  
      CGContextSetRGBFillColor(ctx, 1.0, 0.0, 0.0, 1); // red
      CGContextFillRect(ctx, CGRectMake(0, 0, parentViewWidth, h))
      println("in drawRect, h = \(h)")
  
  }
  </code></pre>