Вместо этого сохраняйте ссылку на точку, в которой вы хотите, чтобы все ваши изображения тоже двигались. Использование NSTimer и перемещение всех изображений самостоятельно по таймеру в конечном итоге значительно замедлит работу вашего приложения (я знаю из опыта). Используйте анимационные блоки UIView и просто скажите, чтобы он перемещался к точке, в которой вы его создаете.
-(void) createNewImage {
UIImage * image = [UIImage imageNamed:@"abouffer_03.png"];
imageView = [[[UIImageView alloc] initWithImage:image] autorelease];
[imageView setCenter:[self randomPointSquare]];
//Move to the centerPoint
[self moveTheImage:imageView];
[imageViewArray addObject:imageView];
[[self view] addSubview:imageView];
}
-(void)moveTheImage:(UIImageView *)imageView {
[UIView animateWithDuration:1.0
animations:^{
[imageView setCenter:centerPoint];
}];
}
-(void)viewDidLoad {
[super viewDidLoad];
imageViewArray = [[NSMutableArray alloc]init];
//IDK what all that other code was
centerPoint = self.view.center;
}
РЕДАКТИРОВАТЬ: Нахождение UIImage во время анимации
Вам необходимо сослаться на слой представления UIImageView, чтобы найти его положение во время анимации
UIImageView *image = [imageViewArray objectAtIndex:0];
CGRect currentFrame = [[[image layer] presentationLayer] frame];
for(UIImageView *otherImage in imageViewArray) {
CGRect objectFrame = [[[otherImage layer] presentationLayer] frame];
if(CGRectIntersectsRect(currentFrame, objectFrame)) {
NSLog(@"OMG, image: %@ intersects object: %@", image, otherImage);
}
}