Hi, i search but i din`t find how to do it, so if anyone could help i appreciate. i want to play a list of sound files and animate images with each sound, the problem is that the animation only start animate when the sound finish play.
the code:
Code:
NSMutableArray *filmSound
= [[NSMutableArray alloc] initWithObjects:
@"piano1.caf",@"piano2.caf",@"piano3.caf",
@"piano4.caf",@"piano5.caf", @"piano6.caf", @"piano7.caf", nil];
self.image.animationImages =
[NSArray arrayWithObjects:[UIImage imageNamed:@"blueButton.png"],
[UIImage imageNamed:@"blueButton2.png"],nil];
for (int i=0; i<7; i++) {
NSString *rowTitle = [filmSound objectAtIndex:i];
NSString *path =
[[NSBundle mainBundle] pathForResource:rowTitle ofType:nil];
self.theAudio = [AVAudioPlayer alloc];
if([theAudio initWithContentsOfURL:
[NSURL fileURLWithPath:path] error:NULL]) {
[theAudio autorelease];
}
else {
[theAudio release];
theAudio = nil;
}
[self.theAudio setDelegate:self];
[self.theAudio play];
self.image.animationDuration = 1;
self.image.animationRepeatCount = 1;
[self.image startAnimating];
[NSThread sleepForTimeInterval:0.2];
i want in each interation to make one animation
Thnks