enumerateKeysAndObjectsUsingBlock:
Applies a given block object to the entries of the dictionary.
- (void)enumerateKeysAndObjectsUsingBlock:(void (^)(id key, id obj, BOOL *stop))block
Parameters of [NSDictionary enumerateKeysAndObjectsUsingBlock]
- block
- A block object to operate on entries in the dictionary.
Discussion
If the block sets
*stop
to YES
, the enumeration stops.
Example of [NSDictionary enumerateKeysAndObjectsUsingBlock]
NSMutableArray* parametersArray = [[[NSMutableArray alloc] init] autorelease];
[dict enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
[parametersArray addObject:[NSString stringWithFormat:@"%@=%@", key, obj]];
}];
NSString* parameterString = [parametersArray componentsJoinedByString:@"&"];
Example of [NSDictionary enumerateKeysAndObjectsUsingBlock]
[self.visibleViewControllers_ enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
if (CGRectIntersectsRect(visibleRect, viewRect)) {
*stop =YES;
}
}];