rick
rick

Reputation: 1125

nstableview reload not working

I am having trouble reloading my NSTableView. The regular reloadData method doesn't work:

[_tableView reloadData];

The NSTableView populates correctly when the application launches. The tableview has it's datasource and delegate set to the AppDelegate, and the tableView's referencing outlet is set to the AppDelegate as well.

I am pretty new to this - and I'm not sure how to troubleshoot. Looking around, I think that my connections in IB may be incorrect, however I have tried many different combinations and none of them will let the reloadData function run. I have tried to add the reloadData method to other functions that I know are running, however, it just seems to run reloadData and do nothing - no errors or warnings.

Any assistance would be appreciated - I would prefer tips on how to actually troubleshoot the issue instead of a solution - I'm not here for free code. :)

Upvotes: 0

Views: 3883

Answers (2)

leecbaker
leecbaker

Reputation: 3741

Some things to try:

  • Verify that your data source is being called. Put break points in your data source, preferably at places like:

    – numberOfRowsInTableView:

    - tableView:objectValueForTableColumn:row:

and verify that these functions are being called.

  • Verify that the _tableView's dataSource is set to the class that is providing your data by putting a breakpoint at the -reloadData call, and checking that the dataSource is set properly. You can do this by running the following in the debugger:

    po [_tableView dataSource]

  • Verify that your data source's -numberOfRowsInTableView: method is returning a number greater than 1. This will ensure that there is something in the table for your to see!

Upvotes: 1

rick
rick

Reputation: 1125

I figured it out - my array was being generated in an init method in my class. it should have been generated in the numberOfRowsInTableView method. reloadTable was being called and was working, and the array was changing, however, the array variable was not actually being re-generated.

Upvotes: 1

Related Questions