I'm having problems with pointers and NSMutableArray. When I add an object to an array it gets passed the address of the object. In my method I want to reuse the object, changing certain parameters each time, to build up an array of different objects, however it keeps passing the same address to the array so all objects end up the same. I was hoping using release would work, but no luck. How should I be writing this?
Thanks
Thanks
Code:
MyObject *anObject = [[MyObject alloc] init];
[anObject setSomeParameter:1];
[AllObjects addObject:anObject];
[anObject release];
[anObject setSomeParameter:2];
[allObjects addObject:anObject];
[anObject release];