dispatch_block_t
2017-03-13 本文已影响1297人
SpursGo
dispatch_block_t block = ^{
curIndexPath = [album indexPathForVid:curVideoItem.vid site:curVideoItem.site];
mutableArray = [NSMutableArray array];
if (curIndexPath) {
NSArray *array = [album videoItemsOfPageIndex:curIndexPath.page];
int count = (int)array.count;
for (int i = (int)curIndexPath.index; i < count; i++) {
VideoItem *vitem = array[i];
if (vitem.tvIsVr > 0) {
break;
}
[mutableArray addObject:vitem];
}
} else {
[mutableArray addObject:curVideoItem];
}
};
typedef void (^dispatch_block_t)(void);
Description
The prototype of blocks submitted to dispatch queues, which take no arguments and have no return value.
The declaration of a block allocates storage on the stack. Therefore, this example demonstrates an invalid construct:
说白了就是一个语法糖 GCD为我们声明了一个没有参数 没有返回值的block