There is a ViewController , I select certain data on it, I switch to another ViewController by the button , everything is OK, the data is displayed.

I [self.tableView reloadData]; back, changing the data, reloading the ViewController , I call [self.tableView reloadData]; - the table is not updated.

I tried to do through Notifications - the same. Apparently, the problem is that it refers to the old table.

How to fix it?

    1 answer 1

    Hard to say ready answer. My algorithm when debugging work with tables.

    1. Put a break point on [self.tableView reloadData] and make sure that the method is called.
    2. Check that self.tableView != nil .
    3. Check that self.tableView.dataSource != nil .
    4. Set a breakpoint in the datasource method: -numberOfSectionsInTableView: make sure that the method is being called, check that this method returns non-zero. If the method is not called, see paras. 1-3.
    5. Set a breakpoint in the datasource method: -tableView:numberOfRowsInSection: make sure that the method is being called, check that this method returns non-zero. If not called, see paras. 1-4.
    6. Set breakpoint in datasource method: -tableView:cellForRowAtIndexPath: If called, then at least one section and one cell in the table is. It is necessary to check that the cell returned from this method is at least somehow initialized with data: cell.textLabel.text = @"Hello"; .