title: How to correctly create a custom NSTableViewCell and load it from nib?
body: <p>I found some guidelines for creating something similar for UITableView, but I'm interested in how it's done for Mac OS X. </p>
  
  <p>I have done the following:</p>
  
  <ol>
  <li><p>I have an NSTableView with two columns. For the first row, the template TableCellView "Image &amp; Text Table Cell View" from Object Library works just fine. For the second row, I would like to have something more complicated which requires a custom TableViewCell. </p></li>
  <li><p>a) I created a xib file where I layed out the needed objects from Object Library. 
  b) I subclassed NSTableViewCell, connected my xib file to this class in Identity Inspector, and connected the IBOutlets for the stuff in my xib. </p></li>
  <li><p>I then came back to my NSTableView, drag&amp;dropped the "Text Table Cell View", got rid of the text field, and in the Identity Inspector set up the custom class to be my own subclass of NSTableViewCell.</p></li>
  <li><p>in my</p>
  
  <ul>
  <li>(NSView*) tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row</li>
  </ul></li>
  </ol>
  
  <p>method, I take the identifier </p>
  
  <pre><code>NSString* identifier = [tableColumn identifier];
  </code></pre>
  
  <p>and if it's equal to my second column identifier, I need to return an instance of my subclass. </p>
  
  <p>But how do I do that? I couldn't find something similar to this:</p>
  
  <pre><code>NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SimpleTableCell" owner:self options:nil];
  cell = [nib objectAtIndex:0];
  </code></pre>
  
  <p>I'm using a view-based NSTableView. I'm starting to suspect I am doing it all wrong and there's a better way. Any help greatly appreciated. </p>