<p>I have a custom NSTableView subclass which is bound to a data source (an NSArray) which updates asynchronously. When items are added to the array, rows are automatically added to the tableview. Awesome!</p>

<p>My question is this: How can I detect that this magic has happened so that I can perform some other tasks related to the display of my custom tableview? Is there a method that I can override in my subclass which will be called when the tableview is updated?</p>

You don't need to subclass NSTableView to change its height based on the number of rows. In your controller, just monitor the data array using KVO and adjust the frame size of the tableview's scrollview (you can find it using
```
enclosingScrollView
```
) when rows are added or removed. I've used this technique before and it's worked well. You can use the tableview's
```
rowHeight
```
and
```
intercellSpacing
```
methods to calculate the height of the frame.