iPhone how hide volume overlay when press volume k

2019-04-02 02:28发布

问题:

I have do lots to solve it,like add MPVolumeView,someone says that system volume HUD will hide if you add a instance of MPVolumeView in current,but that not work

i add obsever to observe the volume's change,and take picture

but now i lost in how hide the volume HUD

I had tried the solution that add MPVolumeView instance but won't WORK please give me another way to solve it

Any suggestions would be appreciated.

回答1:

You need to put volume overlay like this:

MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame: CGRectZero];
[self.view addSubview: volumeView];

Now the custom overlay won't be visible. But keep in mind that you are not able to get action on pressing volume buttons you can only be notified about its effect - changing a volume