- #import "NSArray+Ergodic.h"
- @implementation NSArray (Ergodic)
- -(void)enumerateObjectsUsingBlock:(void (^)(id _Nonnull, NSUInteger, BOOL * _Nonnull))block {
-
- for (int i = 0; i<self.count; i++) {
-
- BOOL isYes;
-
- block(self[i], i, &isYes);
-
- if (isYes) break;
- }
- }
- @end
复制代码 因为看不到该方法的具体实现代码,于是自己就尝试着用分类重写了该数组遍历方法enumerateObjectsUsingBlock,仅供参考
|
|