title: CA overlay on UISegmentedControl is overwritten in iOS5
body: <p>I have the following code, which in iOS 4 produces the look of a "disabled" UISegmentedControl. As the attentive reader will notice, I am developing in MonoTouch, thus the c# syntax.</p>
  
  <pre><code>private void MakeOverlayOnLastRatingSegment()
  {
      RemoveOverlayOnLastRatingSegment();
  
      lastRatingDisabledLayer = new CALayer();
      lastRatingDisabledLayer.Frame = new RectangleF(new PointF(0, 0), segmLastRating.Frame.Size);
  
      lastRatingDisabledLayer.CornerRadius = 10.0f;
      lastRatingDisabledLayer.BackgroundColor = UIColor.FromRGBA(0.5f, 0.5f, 0.5f, 0.2f).CGColor;
      segmLastRating.Layer.AddSublayer(lastRatingDisabledLayer);
  }
  </code></pre>
  
  <p>And the result is:</p>
  
  <p><img src="https://i.stack.imgur.com/CMTFb.png" alt="Disabled UISegementedControl in iOS4"></p>
  
  <p>But on iOS5 the result is a bit different. The segment before the selected cell is written on top of my gray layer. It takes a bit close look - more evident on a real device instead of simulator. For some reason the screendump from the simulator is very light.</p>
  
  <p><img src="https://i.stack.imgur.com/GkR6B.png" alt="Disabled UISegmentedControl in iOS5"></p>
  
  <p>Has anyone else experienced this, and do somebody have a workaround?</p>
  
  <p>Best regards
  /Anders</p>