So Im 12 and Im new to Objective c. I am creating an app, and in one part of the app I have to lower troops down from the top of the screen to the bottom. my code for doing this is as follows:
-(void)lowerParatroopers {
for (int x=1; x<=[array count]; x++) {
[array objectAtIndex:x].center=[array objectAtIndex:x].center-1;
}
I have an array called "array" and Every second a new trooper at a random location at the top is appearing, which I add to my array. So I am doing a for loop from 1 to the number of items in the array, and in between the for loop I am getting the next object(a UIImageView of the trooper that randomly gets generated) and lowering it by one pixel, but under the
rray objectAtIndex:x].center=[array objectAtIndex:x].center-1;
I get two errors saying that
Request for member 'center' in something not a union or a structure
Please help me. I think the problem is that I have to create an @property(nonatomic,retain) and a synthesize for each item created. If thats the case, How would I do that in a (void) in the implementation file? Thanks a bunch!