当前位置: 动力学知识库 > 问答 > 编程问答 >

audio - Xcode screen won't update until sound file completes

问题描述:

My app is supposed to change the image file of a UIImage with a button push.

Then a sound file is supposed to play.

But the screen doesn't update until the sound file is finished playing.

Any suggestions would be greatly appreciated.

I've tried adding a delay, but I can't get this to work right.

Thanks.

网友答案:

This sounds (no pun intended) like you have not multi-threaded the code for playing the sound and changing the image. Hence your display is not updating until the sound has finished and the run loop can update the display.

网友答案:

Have you implemented a [audioPlayer prepareToPlay]; before hand?, I've noticed a slight "glitch in the matrix" when you try to play the sound for the first time.

Can you preempt the file to play? e.g. doing it at running at viewdidload?

btw...is the image in the button or somewhere else?

Regards

JimZ

分享给朋友:
您可能感兴趣的文章:
随机阅读: