Passing an IBaction to another ViewController

1.7k Views Asked by At

I have an IBAction button in one UIViewController that I want to perform an action in another UIViewController. How do I do this?

1

There are 1 best solutions below

3
alexandresoli On BEST ANSWER

Declare a method in the second UIViewController and call from the IBAction in the first controller.

Something like this:

-(IBAction)myMethodFromFirstController{

SecondController *secondController = [[SecondController alloc] init];
[secondController method];

}