<-

Delegates

place holder code for now...

View where the method does its action

.h

#import "CBFHelpViewController.h"

@interface CBFViewController : UIViewController <CBFHelpViewControllerDelegate>

mainview.m

  • (void)helpViewController:(CBFHelpViewController *)mainVC didSelectBranding:(BOOL)branding {

    self.useBranding = branding;
    }

  • (BOOL)setBrandingforHelpViewController:(CBFHelpViewController *)helpVC { return self.useBranding; }

View that triggers the method call

.h

@protocol CBFHelpViewControllerDelegate;

@interface CBFHelpViewController : UIViewController

@property (nonatomic, strong) id<CBFHelpViewControllerDelegate>delegate; @end

@protocol CBFHelpViewControllerDelegate

  • (void)helpViewController:(CBFHelpViewController *)helpVC didSelectBranding:(BOOL)branding;
  • (BOOL)setBrandingforHelpViewController:(CBFHelpViewController *)helpVC;

@end

.m

the triggering code (could be inside of a button)

if (self.delegate && [self.delegate respondsToSelector:@selector(setBrandingforHelpViewController:)]) {

self.brandingSwitch.on = [self.delegate setBrandingforHelpViewController:self]; }

if (self.delegate && [self.delegate respondsToSelector:@selector(helpViewController:didSelectBranding:)]) {

[self.delegate helpViewController:self didSelectBranding:useBranding]; NSLog(@"branding: %d", useBranding); }