This is mainly what we become and what is often said Block after Block understand compiler?
is a function block execution context and the encapsulated object,
block the function call is a call that is
this sentence understanding 2
Let's create a class ABlock contains only simple code with Block, as follows:
#import "ABlock.h"
@implementation ABlock
- (void)method {
void (^stackBlock)(void) = ^{
NSLog(@"this is a block");
};
stackBlock();
}
@end
OC underlying implementation is C, it is necessary to convert the file into .m c ++ source code
we open the console, our ABlock file directory, the following code in the console Knock
clang -rewrite-objc ABlock.m
After completion of the command that we will see will be one more ABlock.cpp file in the same directory, that is, the bottom of the class in which oc implementation, open the file, you will see a lot of code here I only posted with block the relevant section