I’m having some trouble calling a method in a different view controller.
Here’s my setup:
ViewController1 -> ViewController2 -> ViewController3
ViewController1 calls ViewController2 using a WEPopoverController invocation:
UIViewController2 *viewCon2 = [[UIViewController2 alloc] init];
navPopover = [[WEPopoverController alloc] initWithContentViewController:viewCon2];
[navPopover presentPopoverFromRect:CGRectMake(0, 0, 50, 57)
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionUp | UIPopoverArrowDirectionDown
animated:YES];
I would like ViewController3 to be able to call a method that exists within ViewController1. Since ViewController3 is not directly initialized from ViewController1, I couldn’t figure out how to use the delegate method to call ViewController1’s method.
Any ideas?
in your ViewController1
vieDidLoadadd the line ..( do remove the observer in dealloc)
then when you want to call the method in view 1 from viewcontroler 3..
Post the notification
When you post the notification
methodFromViewController3method is called in first view ( you have to add that in the view controller)… in your case.. you can just change it to the name of existing method that you would like to call..