Instance Method

enumerateRangesInRange:options:usingBlock:

Enumerates over the ranges in the range of objects using the block

Declaration

- (void)enumerateRangesInRange:(NSRange)range options:(NSEnumerationOptions)opts usingBlock:(void (^)(NSRange range, BOOL *stop))block;

Parameters

range

The range of items to enumerate. If the range intersects a range of the receiver's indexes, then that intersection will be passed to the block.

opts

A bitmask that specifies the NSEnumerationOptions for the enumeration.

block

The block to apply to elements in the index set.

The block takes two arguments:

range

The range of elements.

stop

A reference to a Boolean value. The block can set the value to YES to stop further processing of the array. The stop argument is an out-only argument. You should only ever set this Boolean to YES within the Block.

Discussion

By default, the enumeration starts with the first object and continues serially through the indexed set range to the last object in the range. You can specify NSEnumerationConcurrent and/or NSEnumerationReverse as enumeration options to modify this behavior.

This method executes synchronously.

See Also

Enumerating Index Set Content

- enumerateRangesUsingBlock:

Executes a given block using each object in the index set, in the specified ranges.

- enumerateRangesWithOptions:usingBlock:

Executes a given block using each object in the index set, in the specified ranges.