画面全体でアニメーション化されている 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];
}
];
}
次に、imageView の現在の CGPoint を検出するために、このメソッドを 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 の現在の位置を取得するにはどうすればよいですか?