Help with NSArray

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

  1. macrumors member

    Joined:
    Apr 21, 2007
    #1
    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. macrumors 6502

    Joined:
    Jun 16, 2004
    #2
    NSArrays are immutable, you need a NSMutableArray to do that.
     
  3. macrumors 6502a

    Joined:
    Oct 13, 2007
    #3
    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. thread starter macrumors member

    Joined:
    Apr 21, 2007

Share This Page