在调用块之前/之后,retaincount始终是1.从apple block doc我们知道self应该保留.谁能知道为什么?
NSLog(@"Before block retain count: %d", [self retainCount]);
void (^block)(void) = ^(void){
UIImage* img = [UIImage imageNamed:@"hometown.png"];
[self setImage:img];
NSLog(@"After block retain count: %d", [self retainCount]);
};
block();
Run Code Online (Sandbox Code Playgroud)