NSMutableArrayがあり、そこからテーブルビューをロードします。これで、UIにボタンがあり、ユーザーが配列に入るデータを複数回更新できるようになりました。そして、配列に新しいデータがあるたびに、tableViewを更新したいと思います。配列を更新した後に[tableViewreloadData]を実行するだけで、ビーチボールが発生するようです。これを達成するための良い方法は何でしょうか?
また、配列からNSTableViewを実装する方法としてバインディングを検討してきましたが、オンラインで示されているすべての例では、テーブルにデータを追加するときにバインディングを使用していますか?バインディングを使用してデータを含む配列をtableViewにロードする方法を誰かに教えてもらえますか?
質問が初心者の質問である場合は申し訳ありませんが、誰かが私に正しいデータを教えてくれるかどうかを読んで喜んでいます。ありがとう:)(私は近道を探していません、ただこれらのものにアプローチする方法について経験豊富な人々からいくつかの学んだアドバイスを得ようとしています)
-(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;
}