Hide device Volume HUD view while adjusitng volume

2019-01-11 13:46发布

I was implementing a video player with MPMoviePlayer in my iPad Application, used MPVolumeView for the volume control. My problem is that when i scroll the volume view to adjust the volume is showing the device's volume hud overlay as in the screenshot below.

enter image description here

How can i disable this system volume indicator hud? My code is :

@property (weak, nonatomic) IBOutlet MPVolumeView *playbackMPVolumeView;

//Customizing controller
- (void)customizeVolumeController
{
    _playbackMPVolumeView.showsRouteButton  = YES;
    _playbackMPVolumeView.showsVolumeSlider = YES;
    [_playbackMPVolumeView setVolumeThumbImage:[UIImage imageNamed:@"volume_slider_thumb.png"] forState:UIControlStateNormal];
}

13条回答
我欲成王,谁敢阻挡
2楼-- · 2019-01-11 14:50

This works for me.

MPVolumeView *volumeView2 = [[MPVolumeView alloc] initWithFrame:CGRectMake(-28, -2, 24, 24)];
[self.view addSubview:volumeView2];
volumeView2.showsVolumeSlider = true;
volumeView2.showsRouteButton = false;
_videoPlayer.AllowsAirPlay = false;
查看更多
登录 后发表回答