获取animationUIImageView的坐标

为了这个目的,我在UIImageView的水平位置上进行了animation处理,我用了下面的代码来使用NSTimer

timer = [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(onTimer) userInfo:nil repeats:YES]; -(void)onTimer { [UIView animateWithDuration:10.0f animations:^{ //Moving_Cloud is an image view Moving_Cloud.frame = CGRectMake(200.0f, 150.0f, Moving_Cloud.frame.size.width, Moving_Cloud.frame.size.height); }]; } 

现在我面临的问题是我需要得到animation持续时间后的“Moving_Cloud”的坐标
请帮帮我
提前致谢。

Abhijit Chaudhari从我以前的post中的评论我明白,你想要的不是“animation持续时间之后”的位置而是animation的位置。

如果我仍然不明白,请澄清你的问题。 (或者给我买一个新的大脑)

 -(void) animateMe(){ NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(onTimer:) userInfo:nil repeats:YES]; [UIView animateWithDuration:10.0f animations:^{ //Moving_Cloud is an image view Moving_Cloud.frame = CGRectMake(200.0f, 150.0f, Moving_Cloud.frame.size.width, Moving_Cloud.frame.size.height); }]; } -(void)onTimer:(id)sender{ NSLog(@"Currently in x=%f", [[ddddd.layer presentationLayer] frame].origin.x); NSLog(@"Currently in y=%f", [[ddddd.layer presentationLayer] frame].origin.y); } 
 [UIView animateWithDuration:10.0f animations:^{ Moving_Cloud.frame = CGRectMake(200.0f, 150.0f, Moving_Cloud.frame.size.width, Moving_Cloud.frame.size.height); } completion:^(BOOL finished){ CGPoint newPost = Moving_Cloud.frame.origin; CGFloat xPos = newPost.x; CGFloat yPos = newPost.y; // do stuff ? }]; 

在animation结束时,会触发块“completion:”。
通常你的图像应该在x = 200,y = 150。

请注意,这些坐标是相对于它superview(视图环绕Moving_Cloud视图)。

注意:
按照惯例,我build议将“Moving_Cloud”改为“movingCloud”。
实例类在objective-C中以较低的上限开始。
也不要使用_,而是使用大写字母。