Iphone 在停止按之前,请查看动画

Iphone 在停止按之前,请查看动画,iphone,uiview,Iphone,Uiview,我有两个视图和一个viewcontroller:一个包含UIImageView和image,另一个包含ToucheSBegind和touchesEnded方法: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [viewcontroller moveMethod]; } 如何使moveMethod使动画(例如,移动x轴)平稳重复,直到我停下来推动视图?尝试此代码在x轴上移动视图 CGRect fram

我有两个视图和一个viewcontroller:一个包含UIImageView和image,另一个包含ToucheSBegind和touchesEnded方法:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    [viewcontroller moveMethod];
}

如何使moveMethod使动画(例如,移动x轴)平稳重复,直到我停下来推动视图?

尝试此代码在x轴上移动视图

CGRect frame=view.frame;
frame.origin.x=frame.origin.x+200;
[UIView beginAnimations:@"" context:nil];
[UIView setAnimationDuration:2];
[UIView setAnimationDelegate:self];    
view.frame=frame;
[UIView commitAnimations];

它工作,但动画停止。我正在做这样的事情:-voidTouchesBegined:NSSet touchs with event:UIEvent*event{[viewcontroller moveMethod];viewcontroller.animate=YES;}并且在控制器中:-voidanimationFinished:NSString*animationID finished:boolffinished context:voidcontext{if animate{[self moveMethod]}但是动画会跳起来。动画之间有间隙。那么,您想什么时候停止动画?我按下并没有松开您的手指。只有当森林消失的时候。我有这样的想法:但动画在另一个动画的结束和开始之间跳跃。动画不是连续的。voidanimationFinished:NSString*animationID finished:BOOLfinished上下文:voidcontext{if animate{CGRect frame=view.frame;frame.origin.x=0;//或开始x点视图。frame=frame;[self moveMethod];}}是的,但视图会在下一个动画开始之前停止片刻