Skip to content

Instantly share code, notes, and snippets.

@jonsterling
Created May 31, 2010 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonsterling/419525 to your computer and use it in GitHub Desktop.
Save jonsterling/419525 to your computer and use it in GitHub Desktop.
@interface SomeClass : SomeControllerClass <JSTutorialDelegate>
// ...
@end
@implementation JSTutorial
@synthesize title;
@synthesize body;
@synthesize delegate;
- (void)generateTutorial {
// do something here?
if ([[self delegate] respondsToSelector:@selector(tutorialDidFinish:)]) {
[[self delegate] tutorialDidFinish:self];
}
}
- (void)dealloc {
[title release];
[body release];
[super dealloc];
}
@end
@interface JSTutorial: NSObject {
NSString *title;
NSString *body;
}
- (void)generateTutorial;
@property (nonatomic, retain) NSString *title;
@property (nonatomic, retain) NSString *body;
@end
@protocol JSTutorialDelegate;
@interface JSTutorial: NSObject {
NSString *title;
NSString *body;
id <JSTutorialDelegate> delegate;
}
- (void)generateTutorial;
@property (nonatomic, retain) NSString *title;
@property (nonatomic, retain) NSString *body;
@property (nonatomic, assign) id <JSTutorialDelegate> delegate;
@end
@protocol JSTutorialDelegate <NSObject>
@optional
- (void)tutorialDidFinish:(JSTutorial *)tutorial;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment