Instance Method

enumerateRangesWithOptions:usingBlock:

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

Declaration

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

Parameters

opts

A bitmask that specifies the NSEnumerationOptions for the enumeration (whether it should be performed concurrently and whether it should be performed in reverse order).

block

The block to apply to elements in the index set.

The block takes two arguments:

range

The range of objects of the elements in the index set.

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

- enumerateRangesInRange:options:usingBlock:

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

- enumerateRangesUsingBlock:

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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software