I have setup a delegate method, so that when user selects cell from VC2, it updates the header text of VC1 then pops back to it.
Now I need to add some code that will let me change the array that loads the UITableView in VC1, what is the easiest way to do this?
In VC 1
- (void)didChooseValue:(NSString *)string
{
self.databaseName = string;
NSLog(@"Database Name: %@", self.databaseName);
[self.myTableView reloadData];
}
In VC 2 – didSelectRowAtIndex
if([delegate respondsToSelector:@selector(didChooseValue:)])
{
[delegate performSelector:@selector(didChooseValue:) withObject:myString];
}
You can add the code in this delegate method itself. Try something like: