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