You can do it through the use of delegation.
When you pass data of UITableViewController
to UIViewController
, you can set a delegate on UIViewController
. Whenever you want to pass data back to UITableViewController
, you can call the delegate and pass in the data
Here's a more concrete example in code
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// Make sure your segue name in storyboard is the same as this line
if ([[segue identifier] isEqualToString:@"YOUR_SEGUE_NAME_HERE"])
{
// Get reference to the destination view controller
UIViewController *vc = [segue destinationViewController];
// Pass the UITableViewController to the UIViewController
[vc setDelegate:self];
}
}
Create a method on UITableViewController
that takes data from UIViewController
(example: -(void)processDataFromUIViewController:(NSString *)string
)
Now when you want to pass data back to UITableViewController
, call [delegate sendDataFromUIViewController:@"data"]