I have been trying to follow along this article on how to use the First Responder.
http://www.cocoanetics.com/2012/09/the-amazing-responder-chain/
And it seems like if A view controller exists in side a container such as a navigation controller, I should be able to call a first responder method that is implemented in another view controller
Here is the layout in Storyboard:
UINavigationController -(relationship)-> UITableViewController1 -(push)-> UITableViewController2
I would like to implement a method in UITableViewController1
ie
- (void)coolMethod:(id) { ... }
But call the method in UITableViewController2
ie
[[UIApplication sharedApplication] sendAction:@selector(coolMethod:) to:nil from:nil forEvent:nil];
What I want is for the sendAction:to:from:forEvent: to send the action up to the UINavigationController and then and then send it down UITableViewController2
Is What I am trying to achieve a possibility? What am I doing wrong?
(Also, I tried linking it up in storyboard, but it will not connect. Clearly something is wrong but I do not know what I am missing)
Any help or advice you could give me would be greatly appreciated!
This isn't what the responder chain is for, and your VC1 is not in the responder chain for VC2. I guess you could implement your own navigation controller subclass to do this, but it wouldn't be good code.
What you're describing is better handled by giving VC2 a delegate property and making VC1 implement the dal agate protocol and set itself as the delegate when VC2 is pushed.