title: How to setup a NSTableView with a custom cell using a subview
body: <p>I am trying to setup a <em>NSTableView</em> with a custom cell using an <em>ArrayController</em> and <em>Bindings</em>. To accomplish this I added a subview to the custom cell. The data connection seems to work somewhat. Though, there seems to be a redraw problem which I cannot fix. When I load the application only some of the cells are rendered. When I scroll through the rows or select one the rendering changes.</p>
  
  <p>I created an <a href="https://github.com/johnjohndoe/NSTableViewCustomCell" rel="nofollow noreferrer">example project on github</a> to illustrate what the problem is.</p>
  
  <p><img src="https://i.stack.imgur.com/xgmDb.png" alt="Screenshot"></p>
  
  <p>The actual source code for the cell rendering can be found <a href="https://github.com/johnjohndoe/NSTableViewCustomCell/blob/master/CustomCell.m" rel="nofollow noreferrer">here</a>:</p>
  
  <pre><code>// CustomCell.m
  - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
  
    if (![m_view superview]) {
      [controlView addSubview:m_view];
    }
  
    // The array controller only gets wrapped data items pack by the NSObjectTransformer.
    // Therefore, objectValue returns a NSObjectWrapper.
    // Unpack the wrapper to retreive the data item.
    DataItem* dataItem = [(NSObjectWrapper*)[self objectValue] original];
    [[m_view name] setStringValue:dataItem.name];
    [[m_view occupation] setStringValue:dataItem.occupation];
    [m_view setFrame:cellFrame];
  }
  </code></pre>
  
  <p>It seems as if the parent <code>controlView</code> does not redraw. Can I force it somehow?</p>