Skip to content

Instantly share code, notes, and snippets.

@jfengq
Last active April 21, 2016 14:22
Show Gist options
  • Save jfengq/2718e8a58b89414b796dfca678f8ee0f to your computer and use it in GitHub Desktop.
Save jfengq/2718e8a58b89414b796dfca678f8ee0f to your computer and use it in GitHub Desktop.
//block声明
返回值类型 block名称 参数1及类型 参数2及类型
void (^blockName)(type argument1, type argument2)
//block定义
void ^(type argument1, type argument2){
//do something
}
//注意block中的循环引用,在block中如果出现对block持有者的强引用,会导致内存泄露。此时应使用__weak修饰变量。
//使用typedef为block起类型名,可以使声明block更方便
typedef void (^ResponseSuccess)(NSDictionary *data);
ResponseSuccess _responseSuccess;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment