ftp.nice.ch/peanuts/GeneralData/Documents/openstep/OpenStepSpec_rtf.tar.gz#/OpenStepSpec_rtf/FoundationKit/Classes/NSArray.rtf

This is NSArray.rtf in view mode; [Download] [Up]

paperh18648 margl-907 margr0 margt0 margb0 fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1994 by NeXT Computer, Inc.  All Rights Reserved.

s4 li100 fi0 ri1007 ql f0 b fs36 fs100 
fs36 NSArray 
pard s11 li2872 fi-2771 ri1007 ql tx2872 f1 b0 fs28 fs48 
fs28 f0 b fs24 Inherits From:tab b0 fs28 f1 NSObject
fs20 
fs28 s6 f0 b fs24 Conforms To:tab b0 fs28 f1 NSCoding, NSCopying, NSMutableCopying
fi0 NSObject (NSObject)
fs20 
fs28 s7 fi-2771 f0 b fs24 Declared In:tab b0 fs28 f1 Foundation/NSArray.h 
fs20 
fs28 pard s16 li100 fi0 ri1007 ql f0 b fs28 fs20 
fs28 Class Description
fs14 
fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 
fs28 The NSArray class declares the programmatic interface to an object that manages an immutable array of objects. (The complementary class NSMutableArray manages modifiable arrays of objects.) NSArray'27s two primitive methods'd0b countb0  and b objectAtIndex:b0 'd0provide the basis for all the other methods in its interface. The b countb0  method returns the number of elements in the array. b objectAtIndex: b0 gives you access to the array elements by index, with index values starting at 0. 
fs16 
fs28 The methodsb  objectEnumeratorb0  and b reverseObjectEnumeratorb0  also permit sequential access of the elements of the array, differing only in the direction of travel through the elements. These methods are provided so that array objects can be traversed in a manner similar to that used for objects of other collection classes, such as NSDictionary.
fs16 
fs28 Generally, you instantiate an NSArray by sending one of the b array...b0  messages to the NSArray class object. These methods return an NSArray containing the elements you pass in as arguments. (Note that arrays can'27t contain b nilb0  objects.) These objects aren'27t copied; rather, each object receives a b retainb0  message before it'27s added to the array. When an object is removed from an array, it'27s sent a b releaseb0  message.
fs16 
fs28 NSArray provides methods for querying the elements of the array. b indexOfObject: b0 searches the array for the object that matches its argument. To determine whether the search is successful, each element of the array is sent an b isEqual:b0  message, as declared in the NSObject protocol. Another method, b indexOfObjectIdenticalTo:b0 , is provided for the less common case of determining whether a specific object is present in the array. b indexOfObjectIdenticalTo:b0  tests each element in the array to see whether its b idb0  matches that of the argument.
fs16 
fs28 NSArray'27sb  makeObjectsPerform:b0  and b makeObjectsPerform:withObject: b0 methods let you act on the individual objects in the array by sending them messages. To act on the array as a whole, a variety of methods are defined. You can create a sorted version of the array (b sortedArrayUsingSelector:b0  and b sortedArrayUsingFunction:context:b0 ), extract a subset of the array (b subarrayWithRange:b0 ), or concatenate the elements of an array of NSString objects into a single string (b componentsJoinedByString:b0 ). In addition, you can compare two array objects using theb  isEqualToArray:b0  and b firstObjectCommonWithArray:b0  methods.
fs16 
fs28 pard s16 li100 fi0 ri1007 ql f0 b fs24 
fs28 Allocating and Initializing an Array
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 + (id)b allocWithZone:b0 (NSZone *)i zonei0 tab Returns an uninitialized array object in i zonei0 .
fi-6552 fs16 
fs28 fi-6552 + (id)b arrayb0 tab Returns an empty array object
fi-6552 fs16 
fs28 fi-6552 + (id)b arrayWithObject:b0 (id)i anObjecti0 tab Returns an NSArray containing the single element i anObject. i0 Raises an NSInvalidArgumentExceptionb  b0 ifb  b0 i anObjectb i0  b0 isb  nilb0 .
fi-6552 fs16 
fs28 fi-6552 + (id)b arrayWithObjects:b0 (id)i firstObj,...i0 tab Returns an NSArray containing the objects in the argument list. The object list is comma-separated and ends with b nilb0 .
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSArray *)b arrayByAddingObject:b0 (id)i anObjecttab i0 Returns an NSArrayi  i0 containing the receiver'27s elements plus i anObjecti0 .
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSArray *)b arrayByAddingObjectsFromArray:b0 (NSArray *)i anotherArray
s9 li7030 fi-6553 fi-5796 i0 tab Returns an NSArray containing the receiver'27s elements plus the elements from i anotherArrayi0 .
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (id)b initWithArray:b0 (NSArray *)i anotherArrayi0 tab Initializes a newly allocated array object by placing in it the objects contained in i anotherArray.
fi-6552 i0 fs16 
fs28 fi-6552 {f3 -} (id)b initWithObjects:b0 (id)i firstObj,...i0 tab Initializes a newly allocated array object by placing in it the objects in the argument list. The object list is comma-separated and ends with b nilb0 . Raises an NSInvalidArgumentExceptionb  b0 ifb  b0 any object in the listi  i0 ofb  b0 objects is b nilb0 .
fi-6552 fs16 
fs28 fi-6552 {f3 -} (id)b initWithObjects:b0 (id *)i objectsi0 tab Initializes a newly allocated array object by placing in 
s9 li7030 fi-6553 fi-5796 b count:b0 (unsigned int)i counti0 tab tab it i counti0  objects from the i objectsi0  array
pard s16 li100 fi0 ri1007 ql f0 b fs48 
fs28 Querying the Array
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (BOOL)b containsObject:b0 (id)i anObjecti0 tab Returns YES if i anObjecti0  is present in the array.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (unsigned int)b countb0 tab Returns the number of objects currently in the array.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (unsigned int)b indexOfObject:b0 (id)i anObjecti0 tab Returns the index of i anObjecti0 , if found; otherwise, returns NSNotFound. This method checks the elements in the array from last to first by sending them an b isEqual:b0  message.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (unsigned int)b indexOfObjectIdenticalTo:b0 (id)i anObjecti0 tab 
s9 li7030 fi-6553 fi-5796 tab Returns the index of i anObjecti0 , if found; otherwise, returns NSNotFound. This method checks the elements in the array from last to first by comparing their b idb0 s.
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (id)b lastObjectb0 tab Returns the last object in the array.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (id)b objectAtIndex:b0 (unsigned int)i indexi0 tab Returns the object located at i indexi0 . An array'27s index starts at 0. Raises an NSRangeException if i indexi0  is beyond the end of the array.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSEnumerator *)b objectEnumeratorb0 tab Returns an enumerator object that lets you access each object in the array, starting with the first element.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSEnumerator *)b reverseObjectEnumeratorb0 tab Returns an enumerator object that lets you access each object in the array, from the last element to the first.
pard s16 li100 fi0 ri1007 ql f0 b fs48 
fs28 Sending Messages to Elements
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (void)b makeObjectsPerform:b0 (SEL)i aSelectori0 tab Sends an i aSelectori0  message to each object in the array.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b makeObjectsPerform:b0 (SEL)i aSelectori0 tab Sends an i aSelectori0  message to each object in the 
s9 li7030 fi-6553 fi-5796 b withObject:b0 (id)i anObjecti0 tab tab array, with i anObjecti0  as an argument.
pard s16 li100 fi0 ri1007 ql f0 b fs48 
fs28 Comparing Arrays
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (id)b firstObjectCommonWithArray:b0 (NSArray *)i otherArray
s9 li7030 fi-6553 fi-5796 i0 tab Returns the first object from the receiver'27s array that'27s equal to an object in i otherArrayi0 .
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (BOOL)b isEqualToArray:b0 (NSArray *)i otherArrayi0 tab Compares the receiving array object to i otherArrayi0 .fs28  
pard s16 li100 fi0 ri1007 ql f0 b fs28 fs48 
fs28 Deriving New Arrays
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (NSArray *)b sortedArrayUsingFunction:b0 (int(*)(id i element1i0 , id i element2i0 , void *i userDatai0 ))i comparatori0 tab 
s9 li7030 fi-6553 fi-5796 b context:b0 (void *)i contexti0 tab Returns an array listing the receiver'27s elements in ascending order as defined by the comparison function i comparatori0 . i contexti0  is passed to the comparator function as its third argument.
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSArray *)b sortedArrayUsingSelector:b0 (SEL)i comparatori0 tab 
s9 li7030 fi-6553 fi-5796 tab Returns an array listing the receiver'27s elements in ascending order, as determined by the comparison method specified by the selector i comparatori0 .
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSArray *)b subarrayWithRange:b0 (NSRange)i rangei0 tab Returns an array containing the receiver'27s elements that fall within the limits specified by i rangei0 .
pard s16 li100 fi0 ri1007 ql f0 b fs48 
fs28 Joining String Elements
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (NSString *)b componentsJoinedByString:b0 (NSString *)i separatori0 tab 
s9 li7030 fi-6553 fi-5796 tab Returns a string that'27s the result of interposing i separatori0  between the elements of the receiver'27s array.
pard s16 li100 fi0 ri1007 ql f0 b fs48 
fs28 Creating a String Description of the Array
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (NSString *)b descriptionb0 tab Returns a string object that represents the contents of the receiver.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSString *)b descriptionWithLocale:b0 (NSDictionary *)i localeDictionary
s9 li7030 fi-6553 fi-5796 i0 tab Returns a string representation of the NSArray object. Included are the key and values that represent the locale data from i localeDictionaryi0 .
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSString *)b descriptionWithLocale:b0 (NSDictionary *)i localeDictionary
s9 li7030 fi-6553 fi-5796 i0 b indent:b0 (unsigned int)i leveli0 tab Returns a string representation of the NSArray object. Included are the key and values that represent the locale data from i localeDictionaryi0 . Elements of the array are indented from the left margin by i leveli0  + 1 multiples of four spaces, to make the output more readable.
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.