Changes

Jump to: navigation, search

Working with Objective-C Array Objects

380 bytes added, 19:19, 6 November 2009
Creating an Array Object
The above code creates a new array object called ''myColors'' and initializes it with four constant string objects containing the strings "Red", "Green", "Blue" and "Yellow".
 
Because we used the NSArray class in the above example the contents of the array object cannot be changed subsequent to initialization. To create a mutable array that will allow the array contents to be modified, we need to use the NSMutableArray class:
 
<pre>
NSMutableArray *myColors;
 
myColors = [NSMutableArray arrayWithObjects: @"Red", @"Green", @"Blue", @"Yellow"];
</pre>
== Finding out the Number of Elements in an Array ==

Navigation menu