Instance Method

objectWithID:

Returns the object in the array with the given identifier.

Declaration

- (ObjectType)objectWithID:(id)identifier;

Parameters

identifier

The identifier of one of the receiver's objects.

Return Value

A reference to the identified object or nil if could not be found.

Discussion

This method is provided as an alternative to objectAtIndex: for applications where an identifier is available instead of (or in addition to) an index. A unique ID is generally more stable than an index. For example, it may be more useful to identify a contact in Address Book by its identifier (which doesn't change over time) than by its index in the list of contacts (which can change as contacts are added or removed).

See Also

Getting Objects in the Array

- objectWithName:

Returns the object in the array with the given name.

- objectAtLocation:

Returns the object at the given location in the receiver.