I am using storyboard and I would like that when the user clicks on a certain button (SwapViewAndTriggerMethod), the view changes to another one (SecondView) defined by a second view controller and then a certain method (MyMethod) present in SecondView.m is called. I am using the code below and this successfully takes me to the other view....but MyMethod does not get called. How can I achieve this please? Cheers!
- (IBAction) SwapViewAndTriggerMethod:(id)sender
{
UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"SecondView_storyboard"];
[self presentViewController:controller animated:YES completion:nil];
[instanceOfGS2controlller MyMethod:nil];
}
This is the error I get: Warning: Attempt to present on < SecondView_ViewController: 0x13f634f60> whose view is not in the window hierarchy! Note: MyMethod calls a picker to select a photo and assign it to an image view.