获取动画UIImageview的坐标 [英] get coordinates of animated UIImageview
问题描述
我为了这个目的在水平位置动画的UIImageview我使用下面的代码我已经使用NSTimer
I am animating an UIImageview in horizontal position for this purpose i have used the below code i have used the 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);
}];
}
现在我面对的问题是我需要得到动画时间后的Moving_Cloud坐标
请帮助我
提前感谢。
now the problem i am facing is i need to get the coordinates of the "Moving_Cloud" after the animate duration
please help me
Thanks in advance.
推荐答案
Abhijit Chaudhari从我上一篇文章中的评论,我明白你想要的不是位置之后的动画时间,而是位置 动画。
Abhijit Chaudhari from the comment in my previous post I understand that what you want is not the position "after the animate duration" but instead the position during the animation.
如果我仍然没有得到它的权利,请澄清你的问题。 (或给我一个新的大脑)
If I still didn't get it right please clarify your question. (Or buy me an new brain)
-(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);
}
这篇关于获取动画UIImageview的坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!