标签:append nss void +++ class pen 可变 col with
//输出10 int x = 10; void(^function)(void) = ^(void) { printf("-----> %d",x); }; x = 12; function();
//输出12 int __block x = 10; void(^function)(void) = ^(void) { printf("-----> %d",x); }; x = 12; function();
上面两个换成NSString一样是这种情况,带__block才会输出后面配置的新值。
//输出ab int __block x = 10; NSMutableString *y = [NSMutableString stringWithString:@"a"]; void(^function)(void) = ^(void) { printf("-----> %d\n",x); printf("++++>%s",[y UTF8String]); }; x = 12; [y appendString:@"b"]; function();
可变对象没有变化
标签:append nss void +++ class pen 可变 col with
原文地址:https://www.cnblogs.com/yuxiaoyiyou/p/11214865.html