誰かが私を正しい方向に導いてくれることを願っています。
ボタンが押された後、画面上の画像を一度に 1 つずつ更新できるようにする必要があります。それらはサイクルの終わりにのみ更新されるように見えますが、これは私がそれを機能させるために必要なものではありません。
私が何をしているのかを示すために、小さな例を作成しました。基本的に、画面に3つの画像があります。ボタンが押されたら、最初の画像を更新し、サウンドを再生し、1 秒待ってから次の画像を更新します。
ただし、1 つの音だけが聞こえ、最後にすべての画像が更新されます。
簡単なことのようです。どうすればいいですか?
#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);
}