title: Layer-Backed NSControl Still Calls NSCell Drawing Routines
body: <h1>Context:</h1>
  <p>Apple has &quot;soft-deprecated&quot; NSCell on macOS. I'm trying to reduce the use of it in my custom NSControl subclasses and, instead, use CALayers to handle my drawing. To do this, I make my NSButton subclass layer-backed:</p>
  <pre><code>self.wantsLayer = YES;
  </code></pre>
  <p>And then I attempt to handle my drawing using the &quot;updateLayer&quot; path instead of &quot;drawRect&quot;:</p>
  <pre><code>- (BOOL) wantsUpdateLayer {
      return YES;
  }
  
  - (void) updateLayer { 
       // Change layer background/border colors if pressed, disabled, etc.
       // Change text color of a CATextLayer sublayer for button's title. 
  }
  </code></pre>
  <hr />
  <h1>The Problem:</h1>
  <p>If I use <code>-updateLayer</code>, the NSCell still receives drawing commands and draws its title, resulting in a &quot;blurry&quot; title string in my control because the string is being drawn twice—once in my textLayer and once by the Cell.</p>
  <p>If, however, I do the exact same work as above in <code>-drawRect:</code> instead of <code>-updateLayer</code>, then the cell does NOT do any drawing (because I don't call down into it with <code>[self.cell drawInteriorWithFrame:ControlView:]</code>)</p>
  <p>I cannot, for the life of me, figure out what's firing the cell drawing when the associated controlView (my button subclass) has opted into <code>-updateLayer</code> instead of <code>-drawRect:</code>.</p>
  <p>I have looked at all the methods on NSControl.h and NSView.h. I've overridden all of the <code>-updateCell</code> and associated methods. None of those are the culprit. I cannot simply set <code>self.cell=nil</code> because NSControl still relies on NSCell for event handling, etc.</p>
  <p>Can someone tell me how to stop NSCell from drawing when its associated controlView is using <code>-updateLayer</code> instead of <code>-drawRect:</code>?</p>