での作業私はのviewDidLoadで2つの方法を実行しているし、それらの間の画像が、黒い画面を変更しないと10秒後に私は結果だけを参照してくださいここで10秒NSRunLoop
-(void)nextImage{ //charging a random image in the image view
index = [[NSArray alloc]initWithObjects:@"1.jpg",@"2.jpg",@"3.jpg",@"4.jpg",@"5.jpg",nil];
NSUInteger randomIndex = arc4random() % [index count];
NSString *imageName = [index objectAtIndex:randomIndex];
NSLog(@"%@",imageName);
self.banner=[UIImage imageNamed:imageName];
self.imageView.image=banner;
[imageName release];
}
-(void)horror{
self.banner=[UIImage imageNamed:@"Flo.jpg"];
self.imageView.image=banner;
NSString *path = [NSString stringWithFormat:@"%@%@",[[NSBundle mainBundle] resourcePath],@"/scream.wav"];
SystemSoundID soundID;
NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
AudioServicesPlaySystemSound(soundID);
}
- (void)viewDidLoad
{
[self nextImage];
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:10.0]];
[self horror];
[super viewDidLoad];
}
ためNSRunLoopを実行しているイム[ホラー]の。反対側では、私は[nextImage]をviewDidLoadで画像の変更を維持するとき、私はNSRunLoopで何かがうまくいかないと思う。
thanx thats right :) –