I have a problem when I want to call a function defined in one view controller from another controller. I'm trying to figure out what seems like a hundred different installations and nothing works.
I posted the base code and was hoping someone would tell me how they would do it. Basically, all I want to do is call the MYBPress function defined in SwitchViewController from the GameViewController when the dealB button is clicked. Any help would be greatly appreciated. PS: I coded for a long time, but I'm really new to Obj-C
#import <UIKit/UIKit.h>
@class GameViewController;
@class OptionsViewController;
@interface SwitchViewController : UIViewController {
OptionsViewController *optionsViewController;
}
@property ( retain, nonatomic ) OptionsViewController *optionsViewController;
@property ( retain, nonatomic ) GameViewController *gameViewController;
-(IBAction)MyBPress:(id)sender;
@end
#import <UIKit/UIKit.h>
@interface GameViewController : UIViewController {
IBOutlet UIButton *dealB;
}
@property(nonatomic,retain) IBOutlet UIButton *dealB;
- (IBAction)dealB:(id)sender;
@end
#import "GameViewController.h"
@implementation GameViewController
@synthesize dealB;
- (IBAction)dealB:(id)sender
{
}
@end
Rick
source
share