Instance Method

objectWithName:

Returns the object in the array with the given name.

Declaration

- (ObjectType)objectWithName:(NSString *)name;

Parameters

name

The name of one of the receiver's objects.

Return Value

A reference to the designated object or nil if the object couldn’t be found.

Discussion

This method is provided as an alternative toobjectAtIndex: for applications where a name is available instead of (or in addition to) an index. A name is generally more stable than an index. For example, it is typically more useful to identify a mailbox in Mail by its name than by its index in the list of mailboxes.

See Also

Getting Objects in the Array

- objectWithID:

Returns the object in the array with the given identifier.

- objectAtLocation:

Returns the object at the given location in the receiver.