Hello,
Let's say I have an NSMutable array filled with instances of MyObject
I now want to extract a particular MyObject, edit it and pass it along to another call:
MyObject *x = [[MyObject alloc] init];
x = [myArray objectAtIndex:i];
/*do something to x...*/
But, the next time I acess myArray at the same index, it gives me the value of the edited x. I guess x is a pointer, that when edited changes the value of the array also. How do I not point to the array object, but rather, when assignign x, only get the value of the array object (not a pointer). I want, in some sense, a copy of the value of the array object, and not a pointer.
thanks
Let's say I have an NSMutable array filled with instances of MyObject
I now want to extract a particular MyObject, edit it and pass it along to another call:
MyObject *x = [[MyObject alloc] init];
x = [myArray objectAtIndex:i];
/*do something to x...*/
But, the next time I acess myArray at the same index, it gives me the value of the edited x. I guess x is a pointer, that when edited changes the value of the array also. How do I not point to the array object, but rather, when assignign x, only get the value of the array object (not a pointer). I want, in some sense, a copy of the value of the array object, and not a pointer.
thanks