iOS 获取系统音量
//设置一个全局变量 UISilder * volumeViewSlider; #pragma mark - 获取系统音量 - (void)configureVolume { volumeView = [[MPVolumeView alloc]init]; volumeView.center = CGPointMake([UIScreen mainScreen].bounds.size.width/2, [UIScreen mainScreen].bounds.size.height/2); [volumeView sizeToFit]; volumeView.showsVolumeSlider = NO; [self addSubview:volumeView]; [volumeView userActivity]; for (UIView *view in [volumeView subviews]){ if ([[view.class description] isEqualToString:@"MPVolumeSlider"]){ volumeViewSlider = (UISlider*)view; break; } } }
调节音量
volumeViewSlider.value +=0.01;