如何将类的IBAction方法转换为另一个类
我在Storyboard的帮助下创建了IBAction方法。 如何从另一个类访问此方法?
- (IBAction)display:(ID) sender { }
尝试使用如下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]; }