So I created an NSMutableArray of UIImageView like this:
NSMutableArray* imageViewArray = [[NSMutableArray alloc] init];
for(int i = 0; i < 15; i++){
UIImageView* imageView = [self animationInit:imageArray xPos:0 yPos:480 wFrame:32
hFrame:32 duration:0.5 repeat:0];
[imageViewArray addObject:imageView];
[imageView release];
imageView = nil;
[self.view addSubview:[imageViewArray objectAtIndex:i]];
}
The method “animationInit” is a method I created to init the UIImageView. Its implementation is this:
-(UIImageView*)animationInit:(NSArray*)imageArray xPos:(float)x yPos:(float)y wFrame:
(float)w hFrame:(float)h duration:(float)duration repeat:(float)count {
UIImageView* imageAnimation = [[UIImageView alloc] initWithFrame:CGRectMake(x, y, w, h)];
imageAnimation.animationImages = imageArray;
imageAnimation.animationDuration = duration;
imageAnimation.animationRepeatCount = count;
return imageAnimation;
}
I am able to set the center of each UIImageView in the array using like this:
[imageViewArray objectAtIndex:Index] setCenter:CGPointMake(x, y)];
Now I would like to do be able to modify the x and y points like I would with a normal UIImageView. An example: UIImageView.center = CGPointMake(UIImageView.center.x + 5, UIImageView.center.y + 5);
The problem here is I have no idea how to access the “UIImageView.center.x/y” within the array of UIImageViews. Is there any way to access the “center.x/y” like I was able to with “setCenter:” or would I be better off creating a bunch of CGPoints to hold the x and y of the UIImageViews in the array?
When I try [imageViewArray objectAtInded:Index].center.x, I get the following error.
Request for member ‘center’ in something no a structure or union
Is there a solution or workaround?
In order to access the
xandyvalues of an array ofUIImageViewsyou have to use the following.With that, I was able to use the following.
Like this:
Again sorry for the mess and any confusion I may have caused. I confused the heck out of myself with this one.
(I found the solution and thought it best I share it just in case anyone else runs into the same problem.)