Donovan
Donovan

Reputation: 6122

tableView:heightOfRow: never called

I'm trying to get a row in my table view to resize its height, but the delegate method:

- (CGFloat) tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row

is never called. I have implemented other delegate methods and they work perfectly. Is there something I am not doing?

Thank you!

Upvotes: 1

Views: 582

Answers (2)

Noah Witherspoon
Noah Witherspoon

Reputation: 57139

Are you changing the row heights? From the docs:

Although table views may cache the returned values, you should ensure that this method is efficient. When you change a row's height you must invalidate the existing row height by calling noteHeightOfRowsWithIndexesChanged:. NSTableView automatically invalidates its entire row height cache when reloadData and noteNumberOfRowsChanged are called.

Upvotes: 2

Rob Napier
Rob Napier

Reputation: 299345

Can you confirm that you've implemented other delegate methods and not other datasource methods? A common error is to hook up your datasource but not your delegate. They're different outlets on an NSTableView.

Upvotes: 2

Related Questions