I\'m presenting a ViewController modally. How can I access the parent view controller ?
My architecture is TabBarController=>VC1=>VC2=>VC3=>MVC1, and I want to reach VC3
//You have to get the root, iterate through the root's ViewControllers and then ask for the ParentViewController.
UINavigationController *root = (UINavigationController*)[[(AppDelegate*) [[UIApplication sharedApplication]delegate] window] rootViewController];
for (UIViewController *VC in root.viewControllers) {
if([VC isKindOfClass:[YourParentViewController class]]){
YourParentViewController* parent = (YourParentViewController*)VC;
[parent callMethod]; // your code here
[self dismissViewControllerAnimated:YES completion:nil];
}
}