//作为一个本地变量:
returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...};
//作为一个属性:
@property (nonatomic, copy, nullability) returnType (^blockName)(parameterTypes);
//作为方法参数:
- (void)someMethodThatTakesABlock:(returnType (^nullability)(parameterTypes))blockName;
//作为方法调用的参数:
[someObject someMethodThatTakesABlock:^returnType (parameters) {...}];
//作为一个typedef:
typedef returnType (^TypeName)(parameterTypes);
TypeName blockName = ^returnType(parameters) {...};
网友评论