Hi All, I have a problem where I want to call a function defined in one view controller from another controller. I'v try what seems llke a hundred different setups and nothing seems to work.
I've posted the basic code and was hoping someone could tell me how they would do it. Basically all I want to do is call the MYBPress function defined in the SwitchViewController from the GameViewController when the dealB button is pressed. Any help would be greatly appreciated. PS: I have coded for a long time, but am realtivly new to Obj-C
// ------- SwitchViewController.h ---------------
#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
// -------- GameViewController.h ------------
#import <UIKit/UIKit.h>
@interface GameViewController : UIViewController {
IBOutlet UIButton *dealB;
}
@property(nonatomic,retain) IBOutlet UIButton *dealB;
- (IBAction)dealB:(id)sender;
@end
// ------- GameViewController.m
#import "GameViewController.h"
@implementation GameViewController
@synthesize dealB; // The Deal button
- (IBAction)dealB:(id)sender
{
// Here is where I want to call the MyBPress function
}
@end