PDA

View Full Version : Help with NSArray




zcarter
Mar 17, 2008, 11:24 PM
Hey guys..

Lets say I make the array

NSArray *array = [[NSArray alloc] initWithObjects:@"first", @"second", @"third", nil];

Lets say I want to go back and change a specific value in that array at a certain index number..

How would I do that?

Obviously I know I can do it Manually....but ..lets say later on in the script, I need to add more to it, or change a value..

How would I do that?

- Zac



sord
Mar 17, 2008, 11:39 PM
NSArrays are immutable, you need a NSMutableArray to do that.

larkost
Mar 17, 2008, 11:41 PM
You need to use NSMutableArray if you are going to change things. Take a look at the documentation and things should be more clear.

zcarter
Mar 18, 2008, 12:23 AM
Thanks guys...

Works great..