Correct way of updating an NSTableView in a Core Data app

前端 未结 1 1204
执笔经年
执笔经年 2021-01-15 03:26

I have a Core Data project with an NSTableView where the columns are bound to an NSArrayController. In turn, the controller\'s content is bound to the main managed object co

1条回答
  •  生来不讨喜
    2021-01-15 03:41

    Think I've found it - I added the following to the end of the threaded processing and executed it on the main thread:

    [self.managedObjectContext reset];
    [myArrayController fetch:self];
    

    Resetting the MOC apparently clears it so forcing the controller to redraw the cells. The -fetch appears to be necessary otherwise the table goes blank...

    0 讨论(0)
提交回复
热议问题