动画或从右向左移动图像
问题描述:
我正在编写此代码以将图像从左向右移动,并且它工作正常。 但是,现在我想从右到左这样做。动画或从右向左移动图像
[UIView animateWithDuration:20.0
delay:0.0
options: UIViewAnimationOptionAllowUserInteraction + UIViewAnimationOptionRepeat +UIViewAnimationOptionCurveLinear
animations:^{imageView.frame = CGRectMake(x, 0, 12000, 768);
}
completion:nil];
请帮我一把。 谢谢。
答
更改您的图像视图框架的X坐标。
使用下面
[UIView animateWithDuration:20.0
delay:0.0
options: UIViewAnimationOptionAllowUserInteraction + UIViewAnimationOptionRepeat +UIViewAnimationOptionCurveLinear
animations:^{imageView.frame = CGRectMake(0, 0, 12000, 768);
}
completion:nil];
趣味提示:您还可以CGRects如下:(的CGRect){origin.x = 0,.size.width = 12000,.size.height = 768} whee! – 2011-05-16 07:04:49
@Andrew Pouliot:我已经在我的回答中提到了相同的CGRect :) – Jhaliya 2011-05-16 07:09:35
我只是一个C99粉丝,没关系。 – 2011-05-16 09:16:06