Introduction - If you have any usage issues, please Google them yourself
MUBlockDelegate
============
1.normally, we use delegates as follows:
firstly,
@protocol TestProtcol <NSObject>
- (NSString*) testDelegateMethod:(NSString*) aString
@end
@interface TestDelegateImpl : NSObject<TestProtcol>
@end
and:
@implementation TestDelegateImpl
- (NSString*) testDelegateMethod:(NSString*)aString
{
return aString
}
@end
secondly,
#import "TestProtcol.h"
@interface TestObject : NSObject
@property(nonatomic, weak) id<TestProtcol> delegate
- (NSString*) callDelegate:(NSString*) aString
@end
@implementation TestObject
@synthesize delegate = _delegate
- (NSString*) callDelegate:(NSString*) aString
{
if ([_delegate respondsToSelector:@selector(testDelegateMethod:)]) {
return [_delegate testDelegateMethod:aString]
}
return nil