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 seem
/* Ok, so based on a suggestion to use Notifications, I solved my problem. It's
actually so simple, it ridiculous I had so much trouble with it. Thought I'd
post it just in case some other newbie hits the same type issue.
*/
// in the SwitchViewController.m I added this. This sets it up so
// when the dealNotification
// is triggered, the HideBar function I have defined in SwitchViewController
// gets called.
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(HideBar) name:@"dealNotification" object: nil];
// in the GameViewController.m where I want to call the function in the other controller,
// I added this and it send the notification to run the function
[[NSNotificationCenter defaultCenter] postNotificationName:@"dealNotification" object: nil];