0
我有一個圖像動畫,總共持續2秒,共6張圖像。這是一個閃爍的按鈕。每次按鈕閃爍時我都想播放聲音,所以在0.66秒間隔3次。我試圖做到這一點,但最後的聲音播放其微秒的延遲,我不想要..我可以做什麼來播放聲音是正確的?圖像動畫與聲音
我這樣做:
-(void)playAnswerAnimSound
{
if(audioActive)
{
if(answerAnimCounter <3)
{
//AudioServicesDisposeSystemSoundID(answerAnimSound);
AudioServicesPlaySystemSound(answerAnimSound);
[answerAnimTimer invalidate];
answerAnimTimer = [NSTimer scheduledTimerWithTimeInterval:0.6666 target:self selector:@selector(playAnswerAnimSound) userInfo:nil repeats:NO];
answerAnimCounter++;
}
else if(answerAnimCounter == 3)
{
answerAnimCounter =0;
[answerAnimTimer invalidate];
}
}
}
聲音持續時間爲1秒。
問候
看看鏈接的答案,也許可以幫助:http://stackoverflow.com/questions/13765341/animation-ios-with-sound-file – rosco
謝謝你的幫助。我已經閱讀過這個答案,但沒有太多幫助。 – mistic
http://stackoverflow.com/a/17127989/763355 – MoDJ