TWcode
TWcode

Reputation: 823

Passing an IBaction to another ViewController

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

Upvotes: 0

Views: 1672

Answers (1)

alexandresoli
alexandresoli

Reputation: 928

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];

}

Upvotes: 1

Related Questions