Help with NSArray

Discussion in 'Mac Programming' started by zcarter, Mar 17, 2008.

  1. zcarter macrumors member

    Apr 21, 2007
    Hey guys..

    Lets say I make the array

    NSArray *array = [[NSArray alloc] initWithObjects:mad:"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
  2. sord macrumors 6502

    Jun 16, 2004
    NSArrays are immutable, you need a NSMutableArray to do that.
  3. larkost macrumors 6502a

    Oct 13, 2007
    You need to use NSMutableArray if you are going to change things. Take a look at the documentation and things should be more clear.
  4. zcarter thread starter macrumors member

    Apr 21, 2007

Share This Page