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を再生して、終了後に自動的に再生されるようにするにはどうすればよいですか?上記のコードを使用しています。

誰でも助けてください。

4

1 に答える 1

1

AVAudioPlayerDelegateにはメソッドがあります

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

サウンドの再生が終了した後に呼び出されます。このメソッドを実装する必要があります。そうすれば、サウンドを再度再生できます。

于 2010-04-01T15:00:31.083 に答える