Xcode 如何在imageView上调用uianimation看起来像圆形
我想创建circle uiimageview动画。当uiimage在Xcode 如何在imageView上调用uianimation看起来像圆形,xcode,uiimage,uianimation,Xcode,Uiimage,Uianimation,我想创建circle uiimageview动画。当uiimage在self.left完成时,立即从uiimageview.right之后再次调用。我想叫动画看起来像,但我的动画是坏的。因为当它完成self.left时,它开始了self.right:(但我想让自己看起来像图: [ ----(end of image)--------- --------(start of image)] Me. I did it. [ -----(end of image)----------
self.left
完成时,立即从uiimageview.right
之后再次调用。我想叫动画看起来像,但我的动画是坏的。因为当它完成self.left时,它开始了self.right:(但我想让自己看起来像图:
[ ----(end of image)--------- --------(start of image)]
Me. I did it.
[ -----(end of image)---------- ]
当完成图像的结尾时,它将出现在后面
我的代码如下所示:
//for start
[UIView beginAnimations:nil context:nil];
imageView.left = - imageView.width;
// imageView2.left = - imageView.width;
[UIView setAnimationDuration:140.0];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(moveToLeft:finished:context:)];
[UIView commitAnimations];
-(void)moveToLeft:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{
imageView.left = self.right;
imageView2.left = self.right + 3600;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:140.0];
[UIView setAnimationDelegate:self];
imageView.left = -imageView.right;
imageView2.left = -imageView2.right;
// imageView.left = - imageView.width;
[UIView setAnimationDidStopSelector:@selector(moveToLeft:finished:context:)];
[UIView commitAnimations];
// imageView.frame.origin.x = imageView.left - self.right
}
如何做到这一点。多亏了而不是使用beginAnimations,现在建议使用基于块的方法(可在iOS4和更高版本上获得) 选项:UIViewAnimationOptionAutoreverse选项将确保动画前后移动。UIViewAnimationOptionRepeat选项将保持动画移动
在块内部,将动画代码添加到视图应移动的位置。然后,它将前后移动到该点。哦,既然你是新来的,你应该知道,如果这解决了你的问题,你应该使用左边的勾号接受答案。
[UIVIew animateWithDuration:140.0 delay:0.0
options:UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat
animations:^(void) {
imageView.frame = CGRectMake( *Add Final position here* );
}
completion:^(BOOL finished) {}];