Reputation: 5
I try to use a ArrayWithObjects to create a scroll's movement. And I have a problem, my animation is stopped and repeat at the number nine :/
This is my code :
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];
Can you help me please ?
Thanks in advance
PS : Sorry for my bad English
Upvotes: 0
Views: 129
Reputation: 17707
Your animationDuration
is too small. You are forcing the object to present all your frame faster than its max possibility.
From the Apple documentation:
The time duration is measured in seconds. The default value of this property is equal to the number of images multiplied by 1/30th of a second. Thus, if you had 30 images, the value would be 1 second.
This means that if you have 24 images
, at least you have to set 0.8
as duration. (24 / 30).
Upvotes: 2