You can store the delegate at the class level (even separately from the delegate at the object level), but for me this is a little suspicious. Here's how you do it:
In your header file:
@interface SomeClass : SomeBaseClass
{
...
}
...
+ (id<SomeDelegateProtocol>)classDelegate
+ (void)setClassDelegate(id<SomeDelegateProtocol>) delegate
+ (void)myCleanupClassMethod
@end
In your implementation file:
@implementation SomeClass
...
static id<SomeDelegateProtocol> _classDelegate = nil;
+ (id<SomeDelegateProtocol>)classDelegate
{
return _classDelegate;
}
+ (void)setClassDelegate(id<SomeDelegateProtocol> delegate
{
_classDelegate = delegate;
}
+ (void)myCleanupClassMethod
{
if ([_classDelegate respondsToSelector:@selector(theDelegateMethod:)])
{
[_classDelegate theDelegateMethod:something];
}
}
@end
, , , ( , myCleanupClassMethod):
[SomeClass setClassDelegate:self];