I'm hoping someone can steer me in the right direction.
I need to be able to update images on the screen one at a time after a button is pressed. It appears that they only get updated at the end of the cycle which is not how I need it to work.
I created a little example to show what I am doing. Basically I have 3 images on the screen. When the button is pressed I want to update the first image, play a sound, wait a second and the update the next etc.
However, I just hear 1 sound and all the images update at the end.
Seems like a simple thing. How should I be doing it?
#import "testappViewController.h"
@implementation testappViewController
@synthesize p1,p2,p3; //UIImageViews
@synthesize button1;
@synthesize volleyFileID;
- (IBAction)buttonpressed:(id)sender
{
NSString *TLS = @"RQP.png";
NSString *volleyPath = [[NSBundle mainBundle] pathForResource:@"click" ofType:@"caf"];
CFURLRef volleyURL = (CFURLRef ) [NSURL fileURLWithPath:volleyPath];
AudioServicesCreateSystemSoundID (volleyURL, &volleyFileID);
TLS = @"RQP.png";
UIImage *sampleimage= [[UIImage imageNamed:TLS] retain];
p1.image = sampleimage;
AudioServicesPlaySystemSound(volleyFileID);
[NSThread sleepForTimeInterval:0.5];
p2.image = sampleimage;
AudioServicesPlaySystemSound(volleyFileID);
[NSThread sleepForTimeInterval:0.5];
p2.image = sampleimage;
AudioServicesPlaySystemSound(volleyFileID);
}