Reprinted from: http://www.cnblogs.com/ihojin/p/block_params.html
Let's take a look at how NSArray passes block parameters
...
@interface NSArray (NSExtendedArray)
…
#if NS_BLOCKS_AVAILABLE
- (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block NS_AVAILABLE(10_6, 4_0);
…
@end
For situations that do not require parameters, such as just want to call another method after the end of a method
//Realization-
(void)endInput:(void (^)())completion
{
[UIView animateWithDuration:0.25 animations:^{
} completion:^(BOOL finished) {
if (completion) {
completion();
}
}];
}
//Call
[instance endInput:^{
//Do something
}];