0
我尝试在我的应用程序中为背景添加动画。如何为背景设置动画?
我使用图像视图与图像和视图加载我开始了一个定时器滚动图像。
这一切都好,我递减x和图像似乎是动画。
但是,当图像结束(对我来说800像素)I RESET X为0,我看到一个丑陋的动画...
有没有更好的办法来解决这个简单的动画?
[...]
[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(scrollBackground) userInfo:nil repeats:YES];
[,,,]
int x = 0;
- (void) scrollBackground {
if (x <= -480) x = 0;
[background setFrame:CGRectMake(x--, background.frame.origin.y, background.frame.size.width, background.frame.size.height)];
}
感谢
解决方法使用:CABasicAnimation animationWithKeyPath:@“transform.translation.x”] – elp 2011-01-29 20:53:49