隐藏ios系统的音量变化显示界面

sdk提供MPVolumeView可以实现该动作,我们在需要添加的view上添加一个隐藏的MPVolumeView即可,注意不能设置width和height为0,也不能设置alpha=0.

//hide the volume view of the system
MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame:CGRectMake(-200, -200, 1, 1)];
//下面的两个属性需要IOS Version>=4.2
volumeView.showsRouteButton = NO;
volumeView.showsVolumeSlider = YES;
volumeView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin;
[self.view addSubview:volumeView];
[volumeView release];

 

XeonWell Studio