아래 코드는 제가 작업하고있는 코드입니다. 나는/원하는 것은Core Animation + Core Audio + 수면이 예상대로되지 않습니다.
기대 :
- 이미지가 페이드; 소리가 들린다; 지연; 이미지가 희미 해집니다.
- 지연, 사운드 재생을 어떻게됩니까
는 이미지가 페이드 다음
많은 감사 어떤 도움 직후 페이드 아웃.
ViewController.m
[self fadein];
NSString *tempFN;
SystemSoundID soundID;
tempFN = [[NSString alloc] initWithFormat:@"%@.caf",
[myGlobals.gTitleArray objectAtIndex:myGlobals.gQuoteCountForLoop]];
NSString *soundFilePath = [NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] resourcePath], tempFN];
NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];
UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty (kAudioSessionProperty_AudioCategory,
sizeof (sessionCategory),
&sessionCategory);
AudioServicesCreateSystemSoundID((__bridge CFURLRef)soundFileURL, &soundID);
AudioServicesPlaySystemSound(soundID);
// Now fade-out the image after a few seconds delay
sleep(3);
[self fadeout];
-(IBAction)fadein
{
[UIImageView beginAnimations:NULL context:nil];
[UIImageView setAnimationDuration:2];
[faceImage setAlpha:0.3];
[UIImageView commitAnimations];
}
-(IBAction)fadeout
{
[UIImageView beginAnimations:NULL context:nil];
[UIImageView setAnimationDuration:1];
[faceImage setAlpha:0];
[UIImageView commitAnimations];
}