I have a class that implements the UITableViewDelegate protocol, and there is another class that processes data, that is, implements the UITableViewDataSource protocol.
@interface TableViewClass : UITableViewController <UITableViewDelegate> @interface TableDataSource : NSObject <UITableViewDataSource>
and I set TableViewClass as a delegate and TableDataSource as a data source
id datasource = [[TableDataSource alloc] init] [self.tableView setDelegate:self]; [self.tableView setDataSource:dataSource];
I retrieve data from an asynchronous server call in the init method from the TableDataSource class, which fills the array and determines the number of rows / sections in the table.
But before the call returns some result, numberOfSectionsInTableView and numberOfRowsInSection will be executed, the result will be 0 rows and 0 sections, and therefore an empty table.
I was thinking about putting [self.tableView reloadData] in a callBack, but I don't have access to the tableView in the datasource class. Can someone tell me how to reload Data in a tableView through the datasource class, as I may need this later to update the data. Thanks
Daffy source share