title: Calling setNeedsDisplay:YES on layer-hosting view does not redraw the view
body: <p>I have a layer-hosting view set up like this in a custom <code>NSView</code> subclass:</p>
  <pre><code>[self setLayer:rootLayer];
  [self setWantsLayer:YES];
  </code></pre>
  <p>I add all the sublayers to the layer tree after I called <code>setNeedsDisplay</code> on each sublayer. Each layer's content is provided by a <code>drawLayer:inContext</code> method of my layer's delegate.</p>
  <p>Here is my problem:</p>
  <p>After initializing my view the view gets draw correctly. However, when the model has changed and I call <code>[myCustomView setNeedsDisplay:YES];</code> from my view controller the <code>drawLayer:inContext</code> is not called.</p>
  <p>I am confused now how to update the view:</p>
  <ul>
  <li>Do I have to call the <code>setNeedsDisplay</code> method on each CALayer in the layer tree?</li>
  <li>Should not the call of <code>setNeedsDisplay:YES</code> on the layer-hosting view itself trigger the redraw of the whole layer tree?</li>
  </ul>
  <p>Thanks for your help.</p>
  <p><strong>Edit</strong></p>
  <p>I have found something in the NSView Class reference</p>
  <blockquote>
  <p>A layer-backed view is a view that is backed by a Core Animation layer. Any drawing done by the view is the cached in the backing layer. You configured a layer-backed view by simply invoking setWantsLayer: with a value of YES. The view class will automatically create the a backing layer for you, and you use the view class’s drawing mechanisms. When using layer-backed views you should never interact directly with the layer.</p>
  <p>A layer-hosting view is a view that contains a Core Animation layer that you intend to manipulate directly. You create a layer-hosting view by instantiating an instance of a Core Animation layer class and setting that layer using the view’s setLayer: method. After doing so, you then invoke setWantsLayer: with a value of YES. When using a layer-hosting view you should not rely on the view for drawing, nor should you add subviews to the layer-hosting view.</p>
  </blockquote>
  <p><a href="http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html" rel="noreferrer">link to documentation</a></p>
  <p>In my case I have a layer-hosting view. So does that indeed mean that I have to trigger the redraw manually? Should I implement a pseudo drawRect method in the custom NSView to call the appropriate setNeedsDisplay on the CALayers that changed?</p>