Instance Method

objectAtIndexedSubscript:

Returns the object located at the specified index.

Declaration

- (ObjectType)objectAtIndexedSubscript:(NSUInteger)idx;

Parameters

idx

An index within the bounds of the fetch result.

Return Value

The object located at index in the fetch result.

Discussion

Raises an exception (NSRangeException) if idx is beyond the end of the fetch result (that is, greater than or equal to the value of the count property).

This method behaves identically to the objectAtIndex: method and allows you to access a fetch result using Objective-C subscript syntax. That is, the two statements below produce the same result:

NSLog(@"First object: %@", [fetchResult objectAtIndex:0]);
NSLog(@"First object: %@", fetchResult[0]);

See Also

Querying a Fetch Result

- containsObject:

Returns whether the specified object is present in the fetch result.

count

The number of objects in the fetch result.

- countOfAssetsWithMediaType:

Returns the number of assets in the fetch result of a specified type.

firstObject

The first object in the fetch result.

lastObject

The last object in the fetch result.

- objectAtIndex:

Returns the object located at the specified index.

- objectsAtIndexes:

Returns an array containing the objects in the fetch result at the indexes in the specified index set.