Refresh Container View on Button Press

memyselfandmyiphone picture memyselfandmyiphone · Jul 11, 2013 · Viewed 7.6k times · Source

I have a UIViewController with a container view which holds a UITableView.

Within the UITableView I have a NSFetchController with NSPredicate that uses variables from the intial UIViewcontroller (I hope your still with me). For one instance that the user changes the container view does not update.

How can I force a reload/update on the container view when this occurs? I looked around but did not see much on this topic.

To be specific I have a UIDatePicker that changes the date on a button. It is this that needs to be updated.

enter image description here

Answer

rdelmar picture rdelmar · Jul 11, 2013

From the initial UIView controller, you can get a reference to the table view controller with self.childViewControllers[0]. So, you need to do it like this:

UITableViewController *tbc = (UITableViewController *)self.childViewControllers[0];
[tbc.tableView reloadData];