如何将类的IBAction方法转换为另一个类

时间:2015-05-14 14:00:19

标签: ios objective-c

我在Storyboard的帮助下创建了IBAction方法。如何从另一个类访问此方法?

- (IBAction)display:(ID) sender
{
}

1 个答案:

答案 0 :(得分:0)

尝试使用如下 FirstViewController.h

@interface FirstViewController: UIViewController
- (void)GetItNow;

FirstViewController.m

- (void)GetItNow{
    NSLog(@"I acheived");    } 

  - (IBAction)goToSecondView:(id)sender {

    SecondViewController* Second= [[SecondViewControlleralloc] initWithNibName:@"SecondViewController" bundle:nil];
    rqVC.addId = self.addId;
    [self.view addSubview:Second.view];

}

SecondViewController.h

@property (nonatomic, assign) id delegate;

SecondViewController.m

- (IBAction)Action_LoadFunds:(id)sender {
    [self.view removeFromSuperview];
    [_delegate GetItNow];

}