作為局部變量:
returnType(^blockName)(parameterTypes) = ^returnType(parameters) {...};
作為屬性:
@property (nonatomic, copy) returnType (^blockName)(parameterTypes);
作為參數(shù):
- (void)someMethodThatTakesABlock:(returnType (^nullability)(parameterTypes))blockName;
作為方法調用參數(shù):
[someObject someMethodThatTakesABlock:^returnType (parameters) {...} ];
作為typedef
typedef returnType (^TypeName)(parameterTypes);
TypeName blockName = ^returnType(parameters) {...};