jpsim / JPSVolumeButtonHandler

JPSVolumeButtonHandler provides an easy block interface to hardware volume buttons on iOS devices. Perfect for camera apps!
MIT License
333 stars 90 forks source link

how to cancel the volumn icon? #13

Closed zltqzj closed 8 years ago

zltqzj commented 9 years ago

Thanks for giving us wonderful demo,I use "JPSVolumeButtonHandler" in my app, but I can not understand that when I start my application,there is a system sound icon appear in the center of screen sometimes , not every time , particularly in ios8. I want to stop it appearing.what should I do? thank you.

jpsim commented 9 years ago

See JPSVolumeButtonHandler.m#L41-L46 for context as to why this is happening. A more appropriate way to do this would be to only change the volume once the view is ready. Since I don't know what's causing the delay in preparing that view to handle volume change notifications, I don't know how to detect when it's ready. Some investigative work will be necessary.

We could also significantly increase the delay to reduce the odds of displaying the volume HUD, but that's even more inelegant than the current approach, which is already hacky.

machard commented 8 years ago

On iOS 9 i have the volume HUD that is displayed everytime I press the volume button. Am I doing something wrong ?

jpsim commented 8 years ago

On iOS 9 i have the volume HUD that is displayed everytime I press the volume button. Am I doing something wrong ?

Nope, there's a race condition in this code. See my previous comment.