I am trying to call reloadData on my UITableView. I am making my app without interface builder.
This code would works with Interface Builder, but does not seem to without.
When I compare my code to what I used to do in interface builder, I am missing the bit in code where I would drag the View Controller to the UITableView. I have the delegates and datasource set and working. Is there something I am missing in my code?
EDIT:
This is set up in my viewDidLoad
The _tableView has the property set and is Synthesized.
//Data is set into an NSArray then copied into an NSMutableArray
_nsarray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:docPath error:NULL];
_nsmArray = [[NSMutableArray alloc] init];
[_nsmArray addObjectsFromArray:_nsarray];
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 416)];
_tableView.delegate = self;
_tableView.dataSource = self;
[self.view addSubview:_tableView];
-(void)refreshTable {
//_tableView = [[UITableView alloc] initWithFrame:CGRectZero];
[self.tableView reloadData];
}
How are you managing your table data? NSArray?
You need to provide these details as what you have posted should work: setting the
dataSourceanddelegateand callingreloadData. When you simply “reloadData” you need to ensure there were changes to the dataSource. If no changes were made to the dataSource (i.e. add / remove an object from the array), then nothing is going to happen.