0
votes

I need help in following scenario.

I am building an app that displays tableview. If the user tap an entry it goes to the detailed screen. In the detail screen, I have a button to delete this entry. It deletes the entry from the data source and dismiss the modal.

But after dismissing the modal, table view data is not refreshing.

If I go back to parent view controller and then again come back to child screen, it refreshes the count.

I read few similar posts and found the following solution.

[tableview reloadData];

Or

[self.tableView reloadData];

In - (void)viewDidAppear:(BOOL)animated of child screen. But its not refreshing the table view.

Please help.

3
Got the answer from .....stackoverflow.com/questions/8437423/… - A.S.

3 Answers

0
votes

For completeness, the full implementation would be:

- (void)viewWillAppear:(BOOL)animated
{
    // Do stuff like reload the tableview data...
    [self.tableView reloadData];
}

If it's not working you have a problem elsewhere in your code.

0
votes

If the tableview is in the parent viewcontroller, I suggest that placing reloadData: method at viewWillAppear: of the parent.

(void)viewWillAppear:(BOOL)animated
{
    [self.tableView reloadData];
}

I'm sure that the method will be called when the detailed viewcontroller dismissed.

0
votes

Go through this code:

- (void)viewWillAppear:(BOOL)animated
{ 
    [self.tableView reloadData];
}