Я пытаюсь найти текущую позицию iPhone ImageView, который анимируется на экране.
Я создаю и анимирую imageView следующим образом
-(IBAction)button:(UIButton *)sender{
UIImageView *myImageView =[[UIImageView alloc] initWithImage:
[UIImage imageNamed:@"ball.png"]];
myImageView.frame = CGRectMake(0, self.view.frame.size.height/2, 40, 40);
[self.view addSubview:myImageView];
[myArray addObject:myImageView];
[UIView animateWithDuration:.5
delay:0
options:(UIViewAnimationOptionAllowUserInteraction) // | something here?)
animations:^{
myImageView.frame = CGRectOffset(myImageView.frame, 500, 0);
}
completion:^(BOOL finished){
[myArray removeObject:myImageView];
[myImageView removeFromSuperview];
[myImageView release];
}
];
}
, а затем, чтобы определить текущую точку CGPoint для imageView, я вызываю этот метод каждые 60 секунд
-(void)findPoint{
for (UIImageView *projectile in bullets) {
label.text = [NSString stringWithFormat:@"%f", projectile.center.x];
label2.text = [NSString stringWithFormat:@"%f", projectile.center.y];
}
}
Однако это дает мне только точку, где заканчивается анимация, я хочу получить текущую CGPoint изображения, которое анимируется на экране. Есть ли вариант, который мне нужно применить, кроме UIViewAnimationOptionAllowUserInteraction, чтобы сделать это? Если нет, как мне получить текущую позицию анимированного imageView?