Basically I have an NSMutableArray set up like so, with instances of another class as the array elements.
[[NSMutableArray alloc] initWithObjects: [[Shape alloc] init], [[Shape alloc] init], nil];
Each of the shape classes has an instance variable that holds what kind of shape it is. I want to be able to make this array so that it assigns a value to the instance variable, something like this, where ShapeVariable is the instance variable in the Shape class, and Square/Circle is the value I want it to have.
[[NSMutableArray alloc] initWithObjects: [[Shape alloc] initwith ShapeVariable Square], [[Shape alloc] initwith ShapeVariable Circle], nil];
Also, I would like to know how to assign two instance variables at the same time to the same element.
Shapeobject.[array objectAtIndex:42]) and then manipulate the Shape directly. Absolutely don't use the array to directly manipulate the objects for you. An array is just a container, nothing more.shape1 = [[Shape alloc] init]Then the same thing for shape two and then I could have a method in the shape class that changes ShapeVariable, call that, and then put them into the array. However, this seems to be sort of inefficient, is there a different way of doing this?