Iphone 将iAction传递给另一个ViewController

Iphone 将iAction传递给另一个ViewController,iphone,objective-c,ipad,iphone-sdk-4.3,Iphone,Objective C,Ipad,Iphone Sdk 4.3,我在一个UIViewController中有一个iAction按钮,我想在另一个UIViewController中执行一个操作。如何执行此操作?在第二个UIViewController中声明一个方法,并从第一个控制器中的iAction调用 大概是这样的: -(IBAction)myMethodFromFirstController{ SecondController *secondController = [[SecondController alloc] init]; [secondCont

我在一个UIViewController中有一个iAction按钮,我想在另一个UIViewController中执行一个操作。如何执行此操作?

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

大概是这样的:

-(IBAction)myMethodFromFirstController{

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

}

该方法在second view controller中会是什么样子?我收到一个错误,没有可见的界面:-(iAction)myMethodFromFirstController{PhoneMainV*secondController=[[PhoneMainV alloc]init];[secondController myMethodFromFirstController];}我想你需要阅读有关ViewController的基础知识,我推荐《大书呆子牧场指南》。无论如何,你可以从这里得到一个完整的教程。