Dockyard > Objective-C Classes > NSArray Additions

NSArray Additions

See also
NSArrayCategory (CocoaDev)
CFPropertyListCreateDeepCopy()

Class Description


Some handy addenda to NSArray, everybody's favorite Cocoa OrderedCollection. Some are for symmetry, some are for kicks, all are for free. Enjoy. (docs taken from CocoaDev)
Simple shortcut for deep mutable copying an NSArray.
Provides basic support for Tiger-only NSArray methods dealing with NSIndexSet. If you are developing a 10.3 application, call one of these methods instead of the standard ones. On a 10.4 system, these methods will simply forward the message. On a 10.3 system, they will do the work themselves. (NSIndexSet does not exist on pre-10.3 systems).

Methods


Retrieving objects

- pantherObjectsAtIndexes:

Copying

- mutableDeepPropertyListCopy

Sending messages to elements

- makeObjectsPerformSelector:withRespectiveObjectsFrom:

- resultsOfMakeObjectsPerformSelector:

- resultsOfMakeObjectsPerformSelector:withObject:

- resultsOfMakeObjectsPerformSelector:withRespectiveObjectsFrom:

Method Detail


makeObjectsPerformSelector:withRespectiveObjectsFrom:

- (void)makeObjectsPerformSelector:(SEL)aSelector withRespectiveObjectsFrom:(id)collection

Sends the aSelector message to each object in the array, starting with the first object and continuing through the array to the last object. The message is sent each time with progressive objects from collection as an argument, so the aSelector method must take a single argument of type id. The aSelector method shouldn't, as a side effect, modify the receiving array. This method raises an NSInvalidArgumentException if aSelector is NULL (modified from ADC docs). collection is any object that responds to objectEnumerator:, and must have the same number of objects as this array.

See also: makeObjectsPerformSelector: (NSArray), resultsOfMakeObjectsPerformSelector:, makeObjectsPerformSelector:withObject: (NSArray), resultsOfMakeObjectsPerformSelector:withObject:, resultsOfMakeObjectsPerformSelector:withRespectiveObjectsFrom:

mutableDeepPropertyListCopy

- (id)mutableDeepPropertyListCopy

Creates a deep mutable copy of this array with a retainCount of 1. Returns nil if an error occured, such as this method being called on an array containing non-property-list objects (i.e., anything besides NSArray, NSData, NSDate, NSDictionary, NSNumber, and NSString).

pantherObjectsAtIndexes:

- (NSArray *)pantherObjectsAtIndexes:(NSIndexSet *)indexSet

Returns an array containing the objects in the receiver at the specified indexes. It is a programming error if any location in indexes exceeds the bounds of the receiver (docs taken from ADC). This method will call objectsAtIndexes: on 10.4 or later systems, and use objectAtIndex: multiple times on 10.3.

See also: objectsAtIndexes: (NSArray)

resultsOfMakeObjectsPerformSelector:

- (NSArray *)resultsOfMakeObjectsPerformSelector:(SEL)aSelector

Sends the aSelector message to each object in the array, starting with the first object and continuing through the array to the last object. The aSelector method must not take any arguments. It shouldn't have the side effect of modifying the receiving array. This method raises an NSInvalidArgumentException if aSelector is NULL (docs taken from ADC). The resulting NSArray contains the results of the method calls, using NSNull in place of nil. It has a one-to-one correspondence with the items in this array.

See also: makeObjectsPerformSelector: (NSArray), makeObjectsPerformSelector:withObject: (NSArray), resultsOfMakeObjectsPerformSelector:withObject:, makeObjectsPerformSelector:withRespectiveObjectsFrom:, resultsOfMakeObjectsPerformSelector:withRespectiveObjectsFrom:

resultsOfMakeObjectsPerformSelector:withObject:

- (NSArray *)resultsOfMakeObjectsPerformSelector:(SEL)aSelector withObject:(id)anObject

Sends the aSelector message to each object in the array, starting with the first object and continuing through the array to the last object. The message is sent each time with anObject as an argument, so the aSelector method must take a single argument of type id. The aSelector method shouldn't, as a side effect, modify the receiving array. This method raises an NSInvalidArgumentException if aSelector is NULL (docs taken from ADC). The resulting NSArray contains the results of the method calls, using NSNull in place of nil. It has a one-to-one correspondence with the items in this array.

See also: makeObjectsPerformSelector: (NSArray), resultsOfMakeObjectsPerformSelector:, makeObjectsPerformSelector:withObject: (NSArray), makeObjectsPerformSelector:withRespectiveObjectsFrom:, resultsOfMakeObjectsPerformSelector:withRespectiveObjectsFrom:

resultsOfMakeObjectsPerformSelector:withRespectiveObjectsFrom:

- (NSArray *)resultsOfMakeObjectsPerformSelector:(SEL)aSelector withRespectiveObjectsFrom:(id)collection

Sends the aSelector message to each object in the array, starting with the first object and continuing through the array to the last object. The message is sent each time with progressive objects from collection as an argument, so the aSelector method must take a single argument of type id. The aSelector method shouldn't, as a side effect, modify the receiving array. This method raises an NSInvalidArgumentException if aSelector is NULL (modified from ADC docs). collection is any object that responds to objectEnumerator:, and must have the same number of objects as this array. The resulting NSArray contains the results of the method calls, using NSNull in place of nil. It has a one-to-one correspondence with the items in this array.

See also: makeObjectsPerformSelector: (NSArray), resultsOfMakeObjectsPerformSelector:, makeObjectsPerformSelector:withObject: (NSArray), resultsOfMakeObjectsPerformSelector:withObject:, resultsOfMakeObjectsPerformSelector:withRespectiveObjectsFrom:

This page was generated with DocYouMeant, a program created by Belkadan Software

Valid XHTML 1.0! Valid CSS!