Created
September 17, 2011 02:50
-
-
Save jonbalbarin/1223571 to your computer and use it in GitHub Desktop.
making a category on a class to contain its protocol methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////////////////////////////////////////////////////////////////// | |
// MyProtocol.h | |
//////////////////////////////////////////////////////////////////////////////// | |
@protocol MyProtocol <NSObject> | |
-(void) thisThingDidDoSomething:(OriginalThing*)sender; | |
-(void) thisThing:(OriginalThing*)sender didDoSomethingWithThing:(Thing*)thing; | |
@end | |
//////////////////////////////////////////////////////////////////////////////// | |
// MyViewController.h | |
//////////////////////////////////////////////////////////////////////////////// | |
@interface MyViewController : UIViewController | |
@end | |
@interface MyViewController(MyProtocolCategory) <MyProtocol> | |
@end | |
//////////////////////////////////////////////////////////////////////////////// | |
// MyViewController.m will contain all the standard VC methods | |
// MyViewController+MyProtocolCategory contains all the MyProtocol stuff | |
//////////////////////////////////////////////////////////////////////////////// | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment