2010-04-01 2 views
1

AVAudioPlayer * myExampleSound;음악이 끝난 후 자동으로 재생되도록 어떻게 재생합니까?

NSString *myExamplePath = [[NSBundle mainBundle] pathForResource:@"myaudiofile" ofType:@"caf"]; 

myExampleSound =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:myExamplePath] error:NULL]; 

myExampleSound.delegate = self; 

[myExampleSound play]; 

myExampleSound를 재생하여 어떻게 끝까지 재생할 수 있습니까? 위의 코드를 사용하고 있습니다.

누구든지 도와주세요.

답변

1

AVAudioPlayerDelegate 사운드 재생이 완료되면 호출되는 방법

- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag 

을 가지고있다. 이 방법을 구현해야만 사운드를 다시 재생할 수 있습니다.