我有一个 UIImageView _winTextImage ......我想在视图上执行 ro 连续动画,从屏幕的左端到右端然后从右端回到左边......但我的代码只显示从右到左(第 2 次)仅动画..我怎样才能一个接一个地获得两个动画..这是我的代码
-(void)animateWin
{
CGRect temp=CGRectMake(0,self.view.frame.size.height/2-_winImageView.frame.size.height/2, _winImageView.frame.size.width, _winImageView.frame.size.height);
_winImageView.frame=temp;
[UIView beginAnimations : @"Display notif" context:nil]; //ANIMATION 1
[UIView setAnimationDuration:0.5];
[UIView setAnimationBeginsFromCurrentState:YES];
temp.origin.x+=self.view.frame.size.width-_winImageView.frame.size.width;
_winImageView.frame=temp;
[UIView commitAnimations];
[UIView beginAnimations : @"Display notif" context:(__bridge void *) (_winImageView)]; //ANIMATION 2
[UIView setAnimationDuration:0.5 ];
temp.origin.x=0;
_winImageView.frame=temp;
[UIView commitAnimations];
}