Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c iOS动画:背景持续移动(游戏)_Objective C_Ios_Animation - Fatal编程技术网

Objective c iOS动画:背景持续移动(游戏)

Objective c iOS动画:背景持续移动(游戏),objective-c,ios,animation,Objective C,Ios,Animation,我目前正在编写一个教育游戏,其中我需要背景不断移动。我尝试过使用块(iOS 4),由于某些原因,结果并不令人满意(即使我指定了线性动画,图像在最后也会变慢。有什么建议吗?谢谢你的帮助 soil0 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"soil900.jpg"]]; soil0.frame = CGRectMake(0, 0, [UIScreen mainScreen].applicationFrame.siz

我目前正在编写一个教育游戏,其中我需要背景不断移动。我尝试过使用块(iOS 4),由于某些原因,结果并不令人满意(即使我指定了线性动画,图像在最后也会变慢。有什么建议吗?谢谢你的帮助

    soil0 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"soil900.jpg"]];
soil0.frame = CGRectMake(0, 0, [UIScreen mainScreen].applicationFrame.size.width, [UIScreen mainScreen].applicationFrame.size.height);

[UIView animateWithDuration:5.0
                      delay:0.0
                    options:UIViewAnimationOptionRepeat | UIViewAnimationCurveLinear
                 animations:^{
                     soil0.transform = CGAffineTransformMakeTranslation(0, -450);  } 
                 completion:^(BOOL fin) { if (fin) 
                 {  
                     soil0.transform = CGAffineTransformMakeTranslation(0, +450);
                 }
                 }];

我想您可能看到了一些缓解。
uiviewmanimationcurvelinear
用于
setAnimationCurve
类方法。请尝试改用
uiviewmanimationoptioncurvelinear