第32月第12天 block stop
阿新 • • 發佈:2019-05-12
break sel nbsp ble arr integer span object ear
1.
- (NSMutableArray *)filterUsingBlock:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))block { if (!block) { return [self mutableCopy]; } NSMutableArray *result = [NSMutableArray array]; NSUInteger idx = 0; BOOL stop = NO; for (id obj in self) {if (block(obj, idx, &stop)) { [result addObject:obj]; if (stop) { break; } } idx++; } return result; }
第32月第12天 block stop