1、作为局部变量
returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...};
2、作为类的属性
@property (nonatomic, copy, nullability) returnType (^blockName)(parameterTypes)
3、方法参数
- (void)someMethodThatTakesABlock:(returnType (^nullability)(parameterTypes))blockName;
4、调用方法是传入的参数
[someObject someMethodThatTakesABlock:^returnType (parameters) {...}];
5、自定义Block类型时
typedef returnType (^TypeName)(parameterTypes);
TypeName blockName = ^returnType(parameters) {...};
网友评论