• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSMutableArray problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableArray problems


  • Subject: Re: NSMutableArray problems
  • From: email@hidden
  • Date: Sun, 21 Mar 2004 18:06:44 -0500 (EST)

I missed the first part of this post so I'm probably speaking foolishly...
but.
2 things.
if the arrays in the main array are not mutatable then you must build a
new array and replace the one you other wise want to edit. (how many
times can we say array in a sentence)

NSArray * theNewlyEditedArray = [NSArray
arrayWithObjects:anObject,anotherObject,etc,nil];
//here you have to rebuild your array kind of from scratch.

[mainArray replaceObjectAtIndex:index withObject:theNewlyEditedArray];

I have used this and similar methods involving arrays to edit or maintain
table/outline data


if the arrays in the main array are mutatable:

[[mainArray objectAtIndex:index] replaceObjectAtIndex:otherIndex
withObject:theNewObject];


//If the arrays in the main array are mutatable then you only need to
change the objects and not the whole array.

Ive used this method a number of times to replace data in drag and drops
or simply edit data in a cell without messing with the rest of an array.

April.

> Are the arrays in the arrayOfRows also mutable arrays?
>
> Charles
>
> On Mar 21, 2004, at 8:27 AM, Sascha Kuehn wrote:
>
>> arrayOfRows is a mutablearray of arrays
>>
>>
>> On 21. Mrz 2004, at 15:18 Uhr, Alan Donsky wrote:
>>
>>> if arrayOfRows in a NSMutableArray, then i think all u need is
>>>
>>> [arrayOfRows replaceObjectAtIndex:j withObject:theString];
>>>
>>> Alan
>> _______________________________________________
>> cocoa-dev mailing list | email@hidden
>> Help/Unsubscribe/Archives:
>> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>> Do not post admin requests to the list. They will be ignored.
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >NSMutableArray problems (From: Sascha Kuehn <email@hidden>)
 >Re: NSMutableArray problems (From: Sascha Kuehn <email@hidden>)
 >Re: NSMutableArray problems (From: Charles Srstka <email@hidden>)

  • Prev by Date: NSBeginAlertSheet noise
  • Next by Date: Re: how do I detect a click in a tableView cell?
  • Previous by thread: Re: NSMutableArray problems
  • Next by thread: Re: NSMutableArray problems
  • Index(es):
    • Date
    • Thread