Search code examples
objective-ccocoacore-datanstableviewnsarraycontroller

NSTableView doesn't update after sorting via column header


I have an NSTableView bound to a core-data-backed NSArrayController by binding individual columns to arraycontroller.arrangedObjects.

I have the default out-of-the-box sorting working, but when I click one of the column headers to sort the table I have problems.

Basically the display of the table gets messed up: rows get duplicated, and the sort order is all over the place.

However, when I click on a row the TableView redraws and everything looks fine.

So, it looks like the sorting is working properly, but it is not being reflected in the display of the tableview until I click on a row.

Can anyone tell me why my tableview isn't updating properly when I sort?

I have Googled this extensively, looked in the docs, and tried everything I can think of in the code but can't work out what is happening.

Thanks

Darren.


Solution

  • The problem was very simple in the end.

    For some reason I had ticked the "Core Animation" layer selector for the TableView, which was causing the display to be garbled.

    When I cleared the tickbox everything started working properly.

    Regards

    Darren.