replace value from nsmutablearray

Discussion in 'iPhone/iPad Programming' started by estupefactika, Feb 23, 2009.

  1. macrumors member

    Joined:
    Feb 16, 2009
    Location:
    Alcobendas (Madrid)
    #1
    Hi, I have a NsMutableArray, at each index there are several keys like:

    Arrat:(
    {
    id=0;
    img="xxx";
    act="xxx";
    },
    {
    ...
    }

    ...
    )

    I would like to replace the value for a determinate key of my array in an index. In documentation I see:

    - (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject

    It would be easy if my array was only index no keys, but with several keys... Any Idea?
     
  2. macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #2
  3. thread starter macrumors member

    Joined:
    Feb 16, 2009
    Location:
    Alcobendas (Madrid)
    #3
    Yes, its an array of NsMutableDictionarys, but how can I to replace? Have I to create a new nsmutabledictionary, to remove the index in array and to add the new NsMutableDictionary to this index? Only I want to replace a key for an index of array.
     
  4. Guest

    caveman_uk

    Joined:
    Feb 17, 2003
    Location:
    Hitchin, Herts, UK
    #4
    If you only want to change one key at one index you could do

    [[myArray objectAtIndex:i] setObject:newObject forKey:key]
     

Share This Page