block各种定义写法

As a local variable:

1
returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...};

As a property:

1
@property (nonatomic, copy) returnType (^blockName)(parameterTypes);

As a method parameter:

1
- (void)someMethodThatTakesABlock:(returnType (^)(parameterTypes))blockName;

As an argument to a method call:

1
[someObject someMethodThatTakesABlock:^returnType (parameters) {...}];

As a typedef:

1
typedef returnType (^TypeName)(parameterTypes);
TypeName blockName = ^returnType(parameters) {...};

This site is not intended to be an exhaustive list of all possible uses of blocks.
If you find yourself needing syntax not listed here, it is likely that a typedef would make your code more readable.

Unable to access this site due to the profanity in the URL? http://goshdarnblocksyntax.com is a more work-friendly mirror.