如何在不使用-reloadData的情况下更新NSTableView?
问题描述:
我是Mac的新手.我正在尝试不使用-reloadData
来更新NSTableView中的特定单元格,因为-reloadData
会更新整个表.我已经尝试了一切,但都徒劳无功.我正在尝试做与我们过去在MFC或.NET中的CListCtrl中所做的类似的事情.
I am new to the Mac. I am trying to update a particular cell in NSTableView without using -reloadData
, as -reloadData
updates the whole table. I have tried everything but all was in vain. I am trying to do something similar to what we used to do in CListCtrl in MFC or in .NET.
答
看看reloadDataForRowIndexes:columnIndexes:
方法.要更新单个单元格,应执行以下操作:
Have a look at reloadDataForRowIndexes:columnIndexes:
method. To update a single cell the following should work:
[yourTable reloadDataForRowIndexes:[NSIndexSet indexSetWithIndex:row]
columnIndexes:[NSIndexSet indexSetWithIndex:column]];