[iOS知识简记]-block

block:

  • http://clang.llvm.org/docs/Block-ABI-Apple.html
  • http://www.arigrant.com/blog/2014/1/18/the-syntax-of-objective-c-blocks
int(^(^scalingFactory)(float))(double) = ^int(^(float a))(double) {
    return ^int(double b) {
        return (a+1) * b;
    };
};

int ret = scalingFactory(1)(2);
NSLog(@"ret=%d", ret);

你可能感兴趣的:(iOS,iOS)