Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/121.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.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
IOS NSArray阵列包含对象_Ios_Arrays_Object_Block - Fatal编程技术网

IOS NSArray阵列包含对象

IOS NSArray阵列包含对象,ios,arrays,object,block,Ios,Arrays,Object,Block,我尝试使用ArrayWithObjects创建卷轴的移动。 我有一个问题,我的动画停止并在第九个位置重复:/ 这是我的代码: background.animationImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"background_wall2.png"], [UIImage imageNamed:@"background_wall3.png"], [UIImage imageNamed:@"background_wall4.

我尝试使用ArrayWithObjects创建卷轴的移动。 我有一个问题,我的动画停止并在第九个位置重复:/

这是我的代码:

background.animationImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"background_wall2.png"], [UIImage imageNamed:@"background_wall3.png"], [UIImage imageNamed:@"background_wall4.png"], [UIImage imageNamed:@"background_wall5.png"], [UIImage imageNamed:@"background_wall6.png"], [UIImage imageNamed:@"background_wall7.png"], [UIImage imageNamed:@"background_wall8.png"], [UIImage imageNamed:@"background_wall9.png"], [UIImage imageNamed:@"background_wall10.png"], [UIImage imageNamed:@"background_wall11.png"], [UIImage imageNamed:@"background_wall12.png"], [UIImage imageNamed:@"background_wall13.png"], [UIImage imageNamed:@"background_wall14.png"], [UIImage imageNamed:@"background_wall15.png"], [UIImage imageNamed:@"background_wall16.png"], [UIImage imageNamed:@"background_wall17.png"], [UIImage imageNamed:@"background_wall18.png"], [UIImage imageNamed:@"background_wall19.png"], [UIImage imageNamed:@"background_wall20.png"], [UIImage imageNamed:@"background_wall21.png"], [UIImage imageNamed:@"background_wall22.png"], [UIImage imageNamed:@"background_wall23.png"], [UIImage imageNamed:@"background_wall24.png"], [UIImage imageNamed:@"background_wall.png"], nil];
[background setAnimationRepeatCount:0];
background.animationDuration = 0.3;
[background startAnimating];
你能帮我吗

提前谢谢


PS:对不起,我的英语不好

你的
动画持续时间
太小了强制对象以高于其最大可能性的速度呈现所有帧

从Apple文档中:

持续时间以秒为单位。此参数的默认值 属性等于图像数乘以一个值的1/30 第二因此,如果有30个图像,则该值为1秒


这意味着如果你有
24张图像
,至少你必须将
0.8
设置为持续时间。
(24/30)。

我忍不住要说一句离题的话:哈哈,好笑话!你是个有趣的家伙。如果第10张图片不是
nil
,我喜欢ItCheck。谢谢!这是一个很好的解决方案:)谢谢你的回答,但我已经尝试过了,但这不起作用:/即使我设置了1秒或更长的持续时间,你也会遇到其他问题,因为文档很清楚,如果不起作用,并且你的所有代码都是正确的,那么苹果UIImageView就会有一个很大的错误。不可能的