NSTableView setting the sort column?

Posted by overcyn on Stack Overflow See other posts from Stack Overflow or by overcyn
Published on 2010-04-14T21:48:24Z Indexed on 2010/04/15 1:53 UTC
Read the original article Hit count: 417

Filed under:
|

I have a NSTableView with multiple columns. clicking each of the columns sorts by the column like in iTunes. However when the tableview first loads the rows are unsorted and no tablecolumn is highlighted or displaying the up/down indicator image. I'm wondering if theres a simple way I can programmatically set the column the table is sorted by and set the indicator image on startup.

The only solution I can think of is using [NSTableView setIndicatorImage: inTableColumn:] and [NSTableView setHighlightedColumn:], but that makes it so that clicking on the header doesnt highlight the column. I would rather not have to use tableView:mouseDownInHeaderOfTableColumn: and rewrite the whole click on header to sort thing.

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about nstableview