536Adding a custom delegate

MyClassWithDelegate.h
#import 

@protocol MyClassWithDelegaet 
@optional
- (void)myDelegateMethod:(NSString*)tsst;
@end

@interface MyClassWithDelegate : NSView {
	id  delegate;
}

@property (nonatomic, assign) id  delegate;

@end
  MyClassWithDelegate.m
#import "MyClassWithDelegate.h"

@implementation MainView

@synthesize delegate;

- (void)anyEvent:(NSEvent *)e { // an event or something like that
	// send delegate
	[[self delegate] myDelegateMethod:@"sss"];
}

@end
Thanks to Jon Sterling for his digest of Apple’s ‘How Delegation Works