摘要: 1. 创建block变量的并使用:1 typedef int (^BLK)(int); // 定义block类型2 3 - (void)doSomething4 {5 BLK foo = ^(int a){ return a*a; }; // 创建block变量6 printf("%d", foo(4)); // 直接调用block7 }2. 不创建block变量,直接创建内联block,比如调用一个对数组进行排序的函数:1 - (void)doSomething2 {3 NSArray *array = nil;4 [array sortedArrayUsin... 阅读全文
posted @ 2013-04-12 14:36 HaipingWuiOS 阅读(292) 评论(0) 推荐(0) 编辑