I have a master-detail application that has a tableview in the masterViewController and in the detailview you can edit and add info into textfields and so on. I have a save button as the rightBarButtonItem in the detail view. If they did not save their work and they hit back I have a UIAlertView that popsup asking them if they want to save their work. Behind the alertview the detailview is still dismissed and the masterviewcontroller is now showing.
So when I hit save the tableview does not update. I have [tableview reloadData] in my masterviewcontroller viewWillAppear but it does not work because the viewappears behind the alertview before the user can hit save. I would like to call the [tableview reloadData] (or something similar) in this method here which is called from my detailview.
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
I can’t just call [tableview reloadData] because the alertViews delegate is set as the detailview because it is pulling all the information from the textfields to save into the plist if they push save on the alertview. Is there a way I can call [tableView reloadData] from my alertView?
I figured it out. What I did was created a property of
UITableViewControllerin my DetailViewController.h file and named it masterView then synthesized it in its .m file. I then went into my masterViewController.m file and found the methodtableView:didSelectRowAtIndexPath:and set my detailsViewController.masterView property to self (self being the masterViewController).I then went into my UIAlertView Save Method and called reloadData on the masterViews tableView
This is very much like passing info to an array or dictionary in the detail view from the
tableView indexPath.rowlike this below (which is also in the methodtableView:didSelectRowAtIndexPath:)