Created
April 19, 2013 21:00
-
-
Save billburgess/5423187 to your computer and use it in GitHub Desktop.
Setting Class method delegates
This file contains hidden or 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
MyClass.h | |
#import "AnotherClass.h" | |
@interface MyClass : NSObject <AnotherClassDelegate> | |
+(void)myMethod; | |
MyClass.m | |
+(void)myMethod { | |
AnotherClass *foo = [[AnotherClass alloc] initWithDelegate:(id<AnotherClassDelegate>)self]; | |
[foo anotherMethod]; | |
} | |
-(void)delegateCallback { | |
// want this to be called | |
} |
That is what I ended up doing and it worked. +1 for @nfarina
You can get an extra point for explaining why. The delegate methods are defined in AnotherClass as -(void). Is it just because only class methods can see other class methods? #noobstick
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Shouldn't it be
+(void)delegateCallback
?