Skip to content

Instantly share code, notes, and snippets.

@jeksys
Created May 9, 2011 19:58
Show Gist options
  • Save jeksys/963263 to your computer and use it in GitHub Desktop.
Save jeksys/963263 to your computer and use it in GitHub Desktop.
Delegate template
@protocol SomeClassDelegate <NSObject>
- (void) SomeClassSelector:(ParamType*)param;
@end
@interface SomeClass : UIViewController {
id <SomeClassDelegate> delegate;
}
@property (nonatomic, assign) id delegate;
- (void) callDelegateMethod;
@end
@implementation AddressBook
@synthesize delegate;
- (void) callDelegateMethod
{
if(delegate && [delegate respondsToSelector:@selector(SomeClassSelector:)])
{
[delegate SomeClassSelector:parameter];
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment