http://www.cnblogs.com/haipingwu/archive/2011/03/17/1986914.html
在Ts.h中:
1 typedef void(^aBlcok)(NSString*a,CGPointpt);
2
3 @interfaceTs
: NSObject {
4
5 aBlcokblk;
6
7 }
8
9 @property(copy)
aBlcok blk;
10
11 - (void)Call:(NSString*)str
AtPoint:(CGPoint)pt;
12
13 @end
ts.m
1 @implementation Ts
2
3 @synthesize blk;
4
5 - (void)Call:(NSString*)str AtPoint:(CGPoint)pt
6
7 {
8
9 if(blk)
10
11 blk(str, pt);
12
13 }
14
15 @end
使用
1 Ts*t = [[Ts alloc]init];
2
3 t.blk= ^(NSString*str,CGPointpt) {
4
5 NSLog(@"%@ %@", str,NSStringFromCGPoint(pt));
6
7 };
8
9 [tCall:@"ABCD" AtPoint:CGPointMake(101,102)];