原遍历数组NSArray * lines = ...for (NSString * line in lines) { // ...}for (int i = 0; i < lines.count; ++i) { NSString * s = [lines objectAtIndex:i]; ...}
原遍历字典
NSDictionary * dict = … NSArray * keys = [dict allKeys]; for (NSString * key in keys) { NSString * value = [dict objectForKey:key]; }
block遍历 [lines enumerateObjectsUsingBlock:^(NSString * obj, NSUInteger idx, BOOL *stop) { }]; [_urlArguments enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { }];
时间: 2024-10-10 05:52:19