我有一個NSMutableArray,並從中加載我的tableview。現在我在UI中有一個Button,它允許用戶刷新多次進入數組的數據。 並且每次都有數據中的新數據我想刷新tableView。 在更新數組後,只是在執行[tableView reloadData]似乎會引起沙灘球。 任何關於什麼是實現這個目標的好方法的想法?用新數據多次清爽NSTableView
而且我一直在考慮看看綁定的方式來從一個數組實現我NSTableView的,但顯示在線使用綁定所有的例子,當他們想要將數據添加到自己的表? 任何人都可以指出我如何使用綁定將數據加載到tableView中?
很抱歉,如果問題是noobie的,我願意看,如果有人可以點我到正確的數據。謝謝:)(我不是在尋找一個快捷方式,只是想從對如何處理這些事情經歷人得到一些教訓諮詢)如果-reloadData
是造成皮球幾乎可以肯定意味着
-(IBAction)refreshList:(id)sender
{
//setup array here and sort the array based on one column. This column has
identifier 'col1' and it works as expected
[aTable reloadData];
}
- (int) numberOfRowsInTableView:(NSTableView *)aTable
{ // return count of array
}
- (id)tableView:(NSTableView *)aTable objectValueForTableColumn: (NSTableColumn *)
tableColumn row:(int)row
{
//set up arrays here to load data in each column
}
- (void)tableView:(NSTableView *)aTableView sortDescriptorsDidChange:(NSArray
*)oldDescriptors
{
//sort here when column headers are clicked
}
-(IBAction)autorefresh:(id)sender
{
// Here i am trying to reload the array and refresh the tableView. I want to
constantly keep refreshing the array and loading the tableView here. The array does
get refreshed but I am having trouble loading the tableView.
for (int i =0; i<=2;i++)
{
// reload the array with data first.
[aTable reloadData];
i = 1;
}
歡迎SO。請正確標記您的問題:) – skaffman 2010-01-10 22:32:25