Instance Method

initWithObjects:

Initializes a newly allocated array by placing in it the objects in the argument list.

Declaration

- (instancetype)initWithObjects:(ObjectType)firstObj, ...;

Parameters

firstObj

The first object for the array.

...

A comma-separated list of additional objects, ending with nil.

Return Value

An array initialized to include the objects in the argument list. The returned object might be different than the original receiver.

Discussion

After an immutable array has been initialized in this way, it can’t be modified.

This method is a designated initializer.

See Also

Initializing an Array

init

Initializes a newly allocated array.

initWithArray:

Initializes a newly allocated array by placing in it the objects contained in a given array.

initWithArray:copyItems:

Initializes a newly allocated array using anArray as the source of data objects for the array.

initWithContentsOfFile:

Initializes a newly allocated array with the contents of the file specified by a given path.

Deprecated
initWithContentsOfURL:

Initializes a newly allocated array with the contents of the location specified by a given URL.

Deprecated
initWithObjects:count:

Initializes a newly allocated array to include a given number of objects from a given C array.