将IBaction传递给另一个ViewController

时间:2012-10-06 20:16:38

标签: iphone objective-c ipad iphone-sdk-4.3

我在一个UIViewController中有一个IBAction按钮,我想在另一个UIViewController中执行一个动作。我该怎么做?

1 个答案:

答案 0 :(得分:1)

在第二个UIViewController中声明一个方法,并从第一个控制器中的IBAction调用。

这样的事情:

-(IBAction)myMethodFromFirstController{

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

}