Object-C 中声明一个Block,共有四种类型
1、声明一个局部Block
NSString * (blockName)(NSString *) = ^ NSString* (NSString* ){ return};
2、声明一个Block属性变量
@property (nonatomic, copy) NSString * ( ^blockName )(NSString *)
3、block作为一个函数的输入参数(省去了blockName)
- (void) someMethodThatTakesBlock:( NSString * (^)(NSString *) )blockName;
4、block作为回调对象而存在(省去了blockName)
[someObj someMethodThatTakesBlock: ^ NSString * (NSString *){...}];
5、宏定义TypedefBlock
typedef NSString* (TypeName)(NSString *);
TypeName blockName = ^NSString* (NSString* ){...};