User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







objective-c:foundation.framework:nsarray.h:init

This is an old revision of the document!


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: (
)

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
objective-c/foundation.framework/nsarray.h/init.1401478918.txt · Last modified: 2024/02/16 01:11 (external edit)

Impressum Datenschutz