Re: how to change an NSArray value without release ?
Re: how to change an NSArray value without release ?
- Subject: Re: how to change an NSArray value without release ?
- From: James Spencer <email@hidden>
- Date: Sun, 13 Nov 2005 19:05:28 -0600
On Nov 13, 2005, at 6:47 PM, Sebosac wrote:
hello,
how can i change the value of an NSArray element without the
pointed object was released ?
thanks in advance.
Assuming that what you are doing is calling one of NSMutableArray's
replaceObject... methods, simply send a retain message to the
original element before doing the replace. You will, of course, also
have to keep a reference to it or you will simply leak. E.g.:
oldElement = [myArray objectAtIndex:index];
[oldElement retain]; // remember you are responsible for releasing
oldElement at some point
[myArray replaceObjectAtIndex:index withObject:newElement]l;
James P. Spencer
Rochester, MN
email@hidden
"Badges?? We don't need no stinkin badges!"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden