title: iOS: How do I support Retina Display with CGLayer?
body: <p>I'm drawing a graph on a CALayer in its delegate method <code>drawLayer:inContext:</code>.</p>
  
  <p>Now I want to support Retina Display, as the graph looks blurry on the latest devices.</p>
  
  <p>For the parts that I draw directly on the graphics context passed by the CALayer, I could nicely draw in high resolution by setting the CALayer's contentScale property as follows.</p>
  
  <pre><code>if ([myLayer respondsToSelector:@selector(setContentsScale:)]) {
      myLayer.contentsScale = [[UIScreen mainScreen] scale];
  }
  </code></pre>
  
  <p>But for the parts that I use CGLayer are still drawn blurry.</p>
  
  <p>How do I draw on a CGLayer in high resolution to support Retina Display?</p>
  
  <p>I want to use CGLayer to draw the same plot shapes of the graph repeatedly, as well as to cut off the graph lines exceeding the edge of the layer.</p>
  
  <p>I get CGLayer by <code>CGLayerCreateWithContex</code> with the graphics context passed from the CALayer, and draw on its context using CG functions such as <code>CGContextFillPath</code> or <code>CGContextAddLineToPoint</code>.</p>
  
  <p>I need to support both iOS 4.x and iOS 3.1.3, both Retina and legacy display.</p>
  
  <p>Thanks,</p>
  
  <p>Kura</p>