I have a parent view controller that modally presents another view controller. When a button is pressed on the presented view controller, I need to have the parent that is presenting the view controller dismiss the presented view controller and then open up a different view controller. Here is my code after the button is pressed:
//Set up a reference to the parent controller
FeedViewController* newsFeed = (FeedViewController*)self.presentingViewController;
//Tell it to dismiss the presented view controller
[newsFeed dismissViewControllerAnimated:YES completion:nil];
//Tell it to open up the other view controller
[newsFeed openNewsCreator];
The problem here is that final line. XCode says that the selector openNewsCreator
is unrecognized by newsFeed
. I tried setting manually giving the presented view controller a reference to the FeedViewController
and it worked fine, so theres nothing missing in my .h file.
I even tried reversing the dismissal and presenting lines like so:
FeedViewController* newsFeed = (FeedViewController*)self.presentingViewController;
[newsFeed openNewsCreator];
[newsFeed dismissViewControllerAnimated:YES completion:nil];
This didn't work either. Any suggestions? Also, here's the error:
reason: '-[UINavigationController openNewsCreator]: unrecognized selector sent to instance 0x9a61760'