How can I call the parent TableView to reload
In this iphone app I'm trying to make it so that when you select a table cell it saves that action, pops the current view controller and calls the previous view controller (which is and always will be a TableView) to reload it's cells with new data.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//update d开发者_StackOverflowata code here
[self.navigationController popViewControllerAnimated:TRUE];
//Here is where I want the code to reload the view [parentTableView reload]; or something }
That's what I have at the moment when you select a cell in the current Table View
You need need to send -reloadData
to the UITableView:
[tableView reloadData];
Edit : So just to clarify, you have a parent UITableViewController which pushes a child UITableViewController onto the navigationController? The code in your sample is implemented in the didSelectRowAtIndexPath in the child view controller?
If this is the case, you need to to add a property to your child UITableViewController which stores a pointer to its parent. Make sure this isn't a reference counted property because that will result in a circular reference. So before you pop your child UITableViewController it can send -reloadData
to the tableView property of its parent.
精彩评论