Table of Contents

init

 
- (id)init
 

Returns an empty array.

Return Value - NSArray

ObjC Sourcecode Example

    // ** Init array **
    NSArray *myArray = [[NSArray alloc]init];
 
    // ** Output array **
    NSLog(@"myArray: %@", myArray);

If you look at the output for this example code, you`ll see that an empty array was initialized! Because this array is immutable it would make more sense to use a init-method that creates it with some objects or at least one object. For example initWithObjects.

Output for this example code

2012-12-02 21:27:29.423 NSArraySample[1536:11303] myArray: (
)