I have an NSMutableArray and I load my tableview from it. Now I have a Button in the UI which kinda lets the user refresh the data that goes into the array multiple times. And everytime there is new data in the Array I want to refresh the tableView. Just doing [tableView reloadData] after updating the array seems to bring up the beachball. ANy ideas on what would be a good way to achieve this ?
Also I have been taking a look at bindings as a way to implement my NSTableView from an array but all the examples shown online use bindings when they want to add data to their tables ? Can anyone point me on how I could load a array with data into tableView using Bindings ?
如果问题不明确,我愿意读一下,如果有人能够向我提出正确的数据。 感谢: (我不寻求捷径,只是试图从有经验的民间人士那里获得一些关于如何处理这些问题的教益......)
-(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;
}